Adds whois server query information to result

@param $result array Result array
@return array Original result array with server query information
968779
public function setWhoisInfo($result)
    {
        $info = array(
            'server' => $this->query['server'],
        );

        if (!empty($this->query['args'])) {
            $info['args'] = $this->query['args'];
        } else {
            $info['args'] = $this->query['query'];
        }

        if (!empty($this->query['server_port'])) {
            $info['port'] = $this->query['server_port'];
        } else {
            $info['port'] = 43;
        }

        if (isset($result['regyinfo']['whois'])) {
            unset($result['regyinfo']['whois']);
        }

        if (isset($result['regyinfo']['rwhois'])) {
            unset($result['regyinfo']['rwhois']);
        }

        $result['regyinfo']['servers'][] = $info;

        return $result;
    }
1239954
public static function legalArrayResult($result)
    {

        if (isset($result['info']) && isset($result['status']) && $result['status'] && is_array($result['info']) && count($result['info']) > 0) {
            return true;
        }

        return false;
    }
86713
protected function create_recordset($result) {
        $rs = new sqlsrv_native_moodle_recordset($result, $this);
        $this->recordsets[] = $rs;
        return $rs;
    }
215196
protected function fixLinks($result)
    {
        if (false === $this->replaceLinks) {
            return $result;
        }

        $isArray = false;
        $string = '';
        if (is_array($result)) {
            $string = json_encode($result, JSON_UNESCAPED_SLASHES);
            $isArray = true;
        } elseif (is_string($result)) {
            $string = $result;
        }

        $myUri = Environment::getURI();

        $allRws = Service::whereType('rws')->whereIsActive(1)->get()->all();
        if (!empty($allRws)) {
            /** @var Service $rws */
            foreach ($allRws as $rws) {
                $config = $rws->getConfigAttribute();
                $baseUrl = trim(array_get($config, 'base_url'), '/');
                $dfUrl = trim($myUri, '/') . '/api/v2/' . $rws->name;
                $string = str_replace($baseUrl, $dfUrl, $string);
            }
        }

        return ($isArray) ? json_decode($string, true) : $string;
    }
37852
protected function parseResult($result) {
 
        if (! property_exists($result, 'return')) {
            return [];
        }

        $result = $result->return;
        
        if (is_null($result)) {
            return [];
        }
        
        if (!is_array($result)) {
            $result = [$result];
        }

        return $this->filterResult($result);
    }
241233
private static function toRow(ResultInterface $result): array
    {
        $row = [
            'id' => $result->getChecker()->getId(),
            'link' => $result->getChecker()->getLink(),
            'description' => $result->getChecker()->getDescription(),
            'status' => $result->getStatus(),
            'messages' => $result->getMessages(),
        ];

        $row['status'] = self::colorize($result, $row['status']);
        $row['message'] = implode(PHP_EOL, $row['messages']);

        return $row;
    }
450283
private function getQueryParameters(&$results) {
    $query = $results->getQuery();

    $html = '<h3>Query Parameters</h3><pre>';
    foreach ($query as $paramName => $value) {
      $html .= "$paramName = $value\n";
    }
    $html .= '</pre>';
    return $html;
  }
620932
protected function append_result($result)
    {
        $this->meta['count'] += $result->count();

        // append UIDs to global index
        $folder = $result->get_parameters('MAILBOX');
        $index  = array_map(function($uid) use ($folder) { return $uid . '-' . $folder; }, $result->get());

        $this->index = array_merge($this->index, $index);
    }
739659
protected function getResponse( $result )
    {
        $this->response
             ->setContent( xmlrpc_encode_request(
                    null, $result,
                    array( 'encoding' => 'utf-8' )
                ) );

        return $this->response;
    }
518390
public function processColumnListing($results)
	{
		$mapping = function ($r) {
			$r = (object) $r;

			return $r->name;
		};

		return array_map($mapping, $results);
	}
809838
protected function filterResult(Result $result)
    {
        $request = $result->getData('request') ?: array();
        foreach (array('AccountNumber', 'RoutingNumber') as $key) {
            if (array_key_exists($key, $request)) {
                $request[$key] = '[filtered]';
            }
        }

        $result->setData('request', $request);

        return $result;
    }
357344
public function addNextPage(Result $result): ? string
    {
        $query = $result->getQuery();
        $urlParameters = $this->generateQueryUrlParameters($result);
        $page = $query->getPage();
        $nextPage = $page + 1;

        if ((($nextPage - 1) * $query->getSize()) > $result->getTotalHits()) {
            return null;
        }

        $urlParameters['page'] = $nextPage;

        return $this->createUrlByUrlParameters(
            $result,
            $urlParameters
        )['route'];
    }
1298025
protected function _decorateResults($result)
    {
        $decorator = $this->_decoratorClass();
        foreach ($this->_mapReduce as $functions) {
            $result = new MapReduce($result, $functions['mapper'], $functions['reducer']);
        }

        if (!empty($this->_mapReduce)) {
            $result = new $decorator($result);
        }

        foreach ($this->_formatters as $formatter) {
            $result = $formatter($result);
        }

        if (!empty($this->_formatters) && !($result instanceof $decorator)) {
            $result = new $decorator($result);
        }

        return $result;
    }
617480
public static function extractResultErrorsInfo(array $result): array
    {
        assert(
            count($result) === 2 &&
            $result[static::REPLY_SUCCESS_VALUE] === null &&
            is_array($result[static::REPLY_ERRORS_INFO]) === true &&
            empty($result[static::REPLY_ERRORS_INFO]) === false
        );

        $value = $result[static::REPLY_ERRORS_INFO];

        return $value;
    }
1162773
public function extractResultIDs($resultInfo)
    {
        $candidates = [];
        foreach ($resultInfo as $insertResult) {
            $newID = $insertResult['id'];
            if (array_key_exists('request-id', $insertResult)) {
                $extid = $insertResult['request-id'];
            } else {
                $extid = null;
            }
            $evidence                      = explode('/', $insertResult['ref'])[3];
            $candidates[$evidence][$extid] = $newID;
        }
        return $candidates;
    }
717414
private function processResults($results)
    {
        $entries = $this->connection->getEntries($results);

        $objects = [];

        if (array_key_exists('count', $entries)) {
            for ($i = 0; $i < $entries['count']; $i++) {
                $entry = $this->newLdapEntry($entries[$i], $this->connection);

                $objects[] = $entry->getAttributes();
            }

            if (!empty($this->sortByField)) {
                return $this->processSortBy($objects);
            }
        }

        return $objects;
    }
1223902
private function getFormattedResults(&$results) {
    return implode('', array(
        $this->getReportInfo($results),
        $this->getPaginationInfo($results),
        $this->getProfileInformation($results),
        $this->getQueryParameters($results),
        $this->getColumnHeaders($results),
        $this->getTotalsForAllResults($results),
        $this->getRows($results)
    ));
    
  }