Return Nginx service Data
@param array $params
@return array
10536
public function getServiceDataDatabaseConnections(array $params) {

        $dataPostgresql = new \Cityware\Monitoring\Models\Services\DataPostgreSql($params);

        $connectionsDatabases = $dataPostgresql->getDataPgSqlDatabasesConnections();

        $return = Array();
        
        $geoipV1 = new \Cityware\Utility\GeoIpV1();
        $geoipV1->geoip_open(DATA_PATH . 'GeoIp/GeoIPASNum.dat', GEOIP_STANDARD);

        foreach ($connectionsDatabases as $key => $value) {

            $desAsnIsp = (!empty($value['client_addr'])) ? \Cityware\Format\Text::convertString($geoipV1->geoip_name_by_addr($value['client_addr'])) : '';

            $return[$key]['des_ip'] = $value['client_addr'];
            $return[$key]['des_asn_isp'] = strtoupper(\Cityware\Format\Text::removeAccents($desAsnIsp));
            $return[$key]['des_hash'] = hash('crc32b', $value['datname']);
            $return[$key]['nam_database'] = $value['datname'];
            $return[$key]['num_total_connections'] = $value['total_connections'];
        }

        return $return;
    }
501080
public function all(array $params = array())
    {
        $endpoint = '/admin/redirects.json';
        $response = $this->request($endpoint, 'GET', $params);
        return $this->createCollection(Redirect::class, $response['redirects']);
    }
511136
public function get(array $params) {
        $this->_requireDataType($params);

        if (array_get($params, 'datatype') === self::METHOD_DICTIONARY) {
            return $this->getDictionary();
        } elseif (array_get($params, 'relatedType') && array_get($params, 'id')) {
            list($response, $httpCode) = $this->_getRelatedResults($params);
        } elseif (array_get($params, 'id')) {
            list($response, $httpCode) = $this->_getSingleResult($params);
        } else {
            list($response, $httpCode) = $this->_getIndex($params);
        }

        return $this->_formatResponse($response, $httpCode);
    }
1204919
protected function readApiName($params = []) {
        /** @var $api */
        /** @var $apiGroup */
        /** @var $operations */
        extract($params);
        $exists = [];
        $apiName = $this->applyFilter('Name', $this->parseApiName($api), compact('api', 'apiGroup'));
        if (isset($operations[$apiName])) {
            $exists[] = "Exists ... $apiName [{$api['name']}]";
            $apiName = $this->applyFilter('Slug', $this->sluggify($api['name']), compact('api', 'apiGroup'));
            $exists[] = " Named it to - ";
            $exists[] = $apiName;
        }
        $apiName = $this->applyFilter('FinalName', $apiName, compact('api', 'apiGroup'));
        if (!empty($exists) && end($exists) !== $apiName) {
            $exists[] = ", but again renamed by filter to - $apiName.";
        }
        if (isset($operations[$apiName])) {
            do {
                if (!empty($exists)) {
                    $exists[] = " ! still";
                }
                $exists[] = " duplicate ! renaming to _{$apiName} [{$api['name']}].";
                $apiName = '_' . $apiName;
            } while (isset($operations[$apiName]));
        }
        if (!empty($exists)) {
//            var_dump(implode("", $exists));
        }
        return $apiName;
    }
150751
protected function call_pluginfo_service(array $params) {

        $serviceurl = $this->get_serviceurl_pluginfo();
        $response = $this->call_service($serviceurl, $params);

        if ($response) {
            if ($response->info['http_code'] == 404) {
                // There is no such plugin found in the plugins directory.
                return false;

            } else if ($response->info['http_code'] == 200 and isset($response->data->status)
                    and $response->data->status === 'OK' and $response->data->apiver == self::APIVER
                    and isset($response->data->pluginfo)) {
                    return $this->validate_pluginfo_format($response->data->pluginfo);

            } else {
                debugging('cURL: Unexpected response', DEBUG_DEVELOPER);
                return false;
            }
        }

        return false;
    }
1328447
public function getServiceDataDatabase(array $params) {

        $dataPostgresql = new \Cityware\Monitoring\Models\Services\DataPostgreSql($params);

        $databases = $dataPostgresql->getDataPgSqlDatabaseStatus();

        $return = Array();

        foreach ($databases as $key => $value) {

            $hitRatio = (($value['blks_hit'] + $value['blks_read']) > 0) ? (($value['blks_hit'] * 100) / ($value['blks_hit'] + $value['blks_read'])) : 0;


            $return[$key]['nam_database'] = $value['datname'];
            $return[$key]['des_hash'] = hash('crc32b', $value['datname']);
            $return[$key]['num_datid'] = $value['datid'];
            $return[$key]['num_commit'] = $value['xact_commit'];
            $return[$key]['num_rollback'] = $value['xact_rollback'];
            $return[$key]['num_blks_read'] = $value['blks_read'];
            $return[$key]['num_blks_hit'] = $value['blks_hit'];
            $return[$key]['num_database_size'] = $value['db_size'];
            $return[$key]['num_database_age'] = $value['db_age'];
            $return[$key]['num_connection_ratio'] = $value['connection_ratio'];
            $return[$key]['num_transactions_per_second'] = $value['transactions_per_second'];
            $return[$key]['num_hit_ratio'] = $hitRatio;
            $return[$key]['num_tup_returned'] = $value['tup_returned'];
            $return[$key]['num_tup_fetched'] = $value['tup_fetched'];
            $return[$key]['num_tup_inserted'] = $value['tup_inserted'];
            $return[$key]['num_tup_updated'] = $value['tup_updated'];
            $return[$key]['num_tup_deleted'] = $value['tup_deleted'];
            $return[$key]['num_backends'] = $value['numbackends'];
            $return[$key]['num_total_connections'] = $value['total_connections'];
            $return[$key]['num_total_seq_scan'] = $value['seq_scan'];
            $return[$key]['num_total_idx_scan'] = $value['idx_scan'];
            $return[$key]['num_total_autovacuum'] = $value['autovacuum_count'];
            $return[$key]['num_total_autoanalyze'] = $value['autoanalyze_count'];
        }

        return $return;
    }
66252
public function getList($params = array())
    {
        $resource = 'georegion.json';
        $resource .= '?' . $this->buildQueryString($params);
        $response = $this->getServiceResponse($resource);

        $geoRegions = new Models\ResponseGeoRegionsGet($response);

        return $geoRegions;
    }
818704
public function get($uri, array $params = array())
    {

        $uri .= '?' . http_build_query($params);
        return $this->client->get($uri);

    }
1331523
public function export(array $params = array()) {
		$result = array(
			'type' => 'list',
			'count' => $this->getCount(),
			'limit' => elgg_extract('limit', $this->options, elgg_get_config('default_limit')),
			'offset' => elgg_extract('offset', $this->options, 0),
			'items' => array(),
		);

		$batch = $this->getBatch();
		foreach ($batch as $entity) {
			$result['items'][] = hypeApps()->graph->export($entity, $params);
		}

		return $result;
	}
424908
protected function mapUriPartsFromServerParams(array $params)
    {
        $parts = [];
        
        $map = [
            'PHP_AUTH_USER' => 'user',
            'PHP_AUTH_PWD' => 'password',
            'HTTP_HOST' => 'host',
            'SERVER_PORT' => 'port',
            'REQUEST_URI' => 'path',
            'QUERY_STRING' => 'query'
        ];
        
        foreach ($map as $param => $key) {
            if (isset($params[$param])) {
                $parts[$key] = $params[$param];
            }
        }
        
        return $parts;
    }
40456
public function getDataTypeParams(array $params)
    {
        $type = $this->getEloquentDataMethod();
        if (in_array($type, ['char', 'string']) && isset($params[0]) && ($length = intval($params[0])) > 0) {
            return [$length];
        }

        if (in_array($type, ['decimal', 'double', 'float'])
            && isset($params[0]) && ($length = intval($params[0])) > 0 && isset($params[1]) && ($decimal = intval($params[1])) > 0) {
            return [$length, $decimal];
        }

        if ($type == 'enum') {
            return $params;
        }

        return [];
    }
668601
public function request($params)
  {
    $query = array_merge($params, [
      'key' => $this->key
    ]);

    try {

      $response = $this->client->get(self::API_ENDPOINT, [
        'query' => $query
      ]);

    } catch (ClientException $exception) {

      return collect([]);

    }

    $results = json_decode($response->getBody(), true);

    $output = [];

    for($i = 0; $i < count($results['itemListElement']); $i++) {
      $output[] = new SearchResult($results['itemListElement'][$i]);
    }

    return collect($output);
  }
720674
protected function fetchResponse($params)
    {
        $qs = http_build_query($params);
        $response = file_get_contents($this->verifyUrl . '?' . $qs);

        return json_decode($response, true);
    }
693009
private function get($path, array $params = [])
    {
        $request = $this->createHttpGetRequest($this->buildUrl($path), $params);

        $response = $this->httpClient->sendRequest($request);

        return $this->parseResponse($response, $request);
    }
809235
protected function extractQueryParameters(array $params)
    {
        $availableParams = ['extract-archive'];
        $query = [];

        foreach ($params as $key => $value) {
            if (in_array($key, $availableParams)) {
                $query[$key] = $value;
            }
        }

        return $query;
    }
378946
public function all(array $params = array())
    {
        $endpoint = '/admin/blogs.json';
        $response = $this->request($endpoint, 'GET', $params);
        return $this->createCollection(Blog::class, $response['blogs']);
    }
75006
public function index($params = [])
    {
        // Set the filters
        $params = (!empty($params))? $params : $this->app->request->input();

        // Get records
        $this->model->params = $params;
        $result = $this->model->search($params)->get();

        // Get pagination and number of records
        $pagination = array_merge(
            ['records' => $this->model->search($params)->count()],
            $this->model->pagination()
        );

        // Return results
        return [
            'success' => true,
            'paging' => $pagination,
            'data' => $result
        ];
    }