Retrieve the data from the pocket API

@param array   $options options to filter the data
@param boolean $isArray if decode JSON to array

@return array
2524
public function retrieve($options = array(), $isArray = false)
    {
        $params = array(
            'consumer_key'  => $this->consumer_key,
            'access_token'  => $this->access_token
        );

        // combine the creds with any options sent
        $params = array_merge($params, $options);

        $request = $this->getClient()->post('/v3/get');
        $request->getParams()->set('redirect.strict', true);
        $request->setHeader('Content-Type', 'application/json; charset=UTF8');
        $request->setHeader('X-Accept', 'application/json');
        $request->setBody(json_encode($params));
        $response = $request->send();

        return json_decode($response->getBody(), $isArray);
    }
541509
public function findBy(array $wheres, array $options = [])
    {
        $query = $this->getSqlObject()->select();

        $this->setColumns($query, $options);

        $wheres = $this->addJoins($query, $wheres, $options);

        $this->addWheres($query, $wheres, $options);

        if (Arr::get($options, 'order')) {
            $this->setOrder($query, $options['order']);
        }

        return $this->executeAndGetResultsAsEntity($query);
    }
420157
public function provide($data = null, array $options = []) : array
    {
        $spacer = isset($options['spacer']) ? (string)$options['spacer'] : ' - ';
        $flatten = isset($options['flatten']) ? (bool)$options['flatten'] : true;

        list($module, $list) = false !== strpos($data, '.') ?
            explode('.', $data, 2) :
            [App::shortName(get_class($this->config->getTable()), 'Model/Table', 'Table'), $data];

        $result = [];
        try {
            $config = new ModuleConfig(ConfigType::LISTS(), $module, $list, ['flatten' => $flatten, 'filter' => true]);
            $config = $config->parse();
            if (! property_exists($config, 'items')) {
                return [];
            }

            $config = json_encode($config->items);
            if (false === $config) {
                return [];
            }

            $result = json_decode($config, true);
        } catch (InvalidArgumentException $e) {
            /* Do nothing.
             *
             * ModuleConfig checks for the file to exist and to be readable and so on, but here we do load lists
             * recursively (for sub-lists, etc), which might result in files not always being there.
             *
             * In this particular case, it's not the end of the world.
             */
            return [];
        }

        if (empty($result)) {
            return [];
        }

        if (! $flatten) {
            return $result;
        }

        foreach ($result as $key => $value) {
            $result[$key] = str_repeat($spacer, substr_count($key, '.')) . $value['label'];
        }

        return $result;
    }
285705
public function fetch($options = array()) {
        $options = new Values($options);

        $params = Values::of(array(
            'CountryCode' => $options['countryCode'],
            'Type' => Serialize::map($options['type'], function($e) { return $e; }),
            'AddOns' => Serialize::map($options['addOns'], function($e) { return $e; }),
        ));

        $params = array_merge($params, Serialize::prefixedCollapsibleMap($options['addOnsData'], 'AddOns'));
        $payload = $this->version->fetch(
            'GET',
            $this->uri,
            $params
        );

        return new PhoneNumberInstance($this->version, $payload, $this->solution['phoneNumber']);
    }
720845
public function getData(Options $options = null)
    {
        if ($options === null) {
            $options = $this->getOptions();
        }

        $this->query_string = $this->assignOptions($this->query, $options);

        try {
            $results = $this->adapter->query($this->query_string, DbWrapperResultset::TYPE_ARRAYOBJECT);

            $r = new ResultSet($results);
            $r->setSource($this);
            $r->setHydrationOptions($options->getHydrationOptions());

            if ($options->hasLimit() && $options->getLimit() > 0) {
                //$row = $this->adapter->query('select FOUND_ROWS() as total_count')->execute()->current();
                $row = $this->adapter->query('select FOUND_ROWS() as total_count')->current();
                $r->setTotalRows($row['total_count']);
            } else {
                $r->setTotalRows($r->count());
            }
        } catch (\Exception $e) {
            throw new Exception\ErrorException(__METHOD__ . ': Cannot retrieve data (' . $e->getMessage() . ')');
        }

        return $r;
    }
1197266
public function get($name, $options = [], $usePeeringServiceManagers = false)
    {
        if (is_string($options)) {
            $options = ['class_name' => $options];
        }

        return parent::get($name, $options, $usePeeringServiceManagers);
    }
707763
public function getLists(array $options = array())
    {

        $uri = $this->buildUserResourceUri('lists');
        $response = $this->makeAuthenticatedApiRequest($uri, $options);

        return $response->lists;

    }
57086
protected function retrievePaginatedListing(array $options)
    {
        $resultPaginator = $this->s3Client->getPaginator('ListObjects', $options);
        $listing = [];

        foreach ($resultPaginator as $result) {
            $listing = array_merge($listing, $result->get('Contents') ?: [], $result->get('CommonPrefixes') ?: []);
        }

        return $listing;
    }
121151
private function getOptions(array $headers, $body, $options, $timeOut, $isAsyncRequest = false, $connectTimeOut = 10)
    {
        $default_options = [
            RequestOptions::HEADERS         => $headers,
            RequestOptions::BODY            => $body,
            RequestOptions::TIMEOUT         => $timeOut,
            RequestOptions::CONNECT_TIMEOUT => $connectTimeOut,
            RequestOptions::SYNCHRONOUS     => !$isAsyncRequest,
        ];

        return array_merge($default_options, $options);
    }
1152445
protected function getFieldValueFromData($data, array $options)
    {
        $fieldValue = $this->config->getProvider('fieldValue');
        $fieldValue = new $fieldValue($this->config);
        $result = $fieldValue->provide($data, $options);

        return $result;
    }
905129
public static function get(string $url, array $options = []) : array {
		$result = [
			'success' => false,
			'error' => [],
			'data' => null
		];
		if (strpos($url, '?') !== false) {
			$url.= '&';
		} else {
			$url.= '?';
		}
		$url.= http_build_query2($options['params']);
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL, $url);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
		$result['data'] = curl_exec($ch);
		if (!empty($options['json'])) {
			$result['data'] = json_decode($result['data'], true);
		}
		curl_close($ch);
		$result['success'] = true;
		return $result;
	}
249095
public static function aIntersec($iArray, $allowArray = array()) {

        try {        
            $return = $iArray; 
            // if empty do not filter the array
            if (!empty($allowArray)) {
                $return = array_intersect_key($iArray, array_flip($allowArray)); 
            }   
            return $return; 
        } catch (Exception $e) {
            echo $e->getTraceAsString();
        }        
        
    }
417215
private function filterArray(array $data, array $options)
    {
        $this->sanitized = true;

        return filter_var_array($data, $options, true);
    }
562013
protected function _getOptions(array $options, array $selected = array(), $isMultiple = false)
    {
        $output = array();

        list($options, $_selected) = $this->_checkNoSelected($options, $selected, $isMultiple);

        foreach ($options as $key => $data) {
            $label = $data;
            $value = $key;

            $classes = implode(' ', array(
                $this->_jbSrt('option'),
                $this->_jbSrt('option-' . Str::slug($value, true)),
            ));

            $isSelected = $this->_isSelected($value, $_selected);

            if (is_array($data)) {
                $output[] = $this->_createGroup($key, $data, $_selected, $options);
            } else {
                $output[] = $this->_option($value, $isSelected, $classes, $label);
            }
        }

        return implode(PHP_EOL, $output);
    }
1202138
public function toArray($assoc = true, $depth = 512, $options = 0)
    {
        return json_decode($this->bodyString(), $assoc, $depth, $options);
    }
855417
private function getOptions(array $options, array $allowed): array
    {
        $result = [];
        foreach ($options as $key => $value) {
            if (\in_array($key, $allowed, false)) {
                $result[$key] = $value;
            }
        }
        return $result;
    }
264886
public function get($url, $data = array(), $options = array())
    {
        $query = http_build_query($data);
        if (!empty($query)) {
            $url = (strpos($url, '?')) ? $url . '&' . $query : $url . '?' . $query;
        }

        $this->request($url, false, $options);

        return $this;
    }