Read Resource

@param mixed $args,... params
@return \ArrayObject
@throws ResourceException
549338
public function get()
    {
        $query = $this->getCriteria();

        $args = func_get_args();
        if(empty($args)){
            $args = null;
        }

        $isCollection = $this->isCollection($args);

        $response = '';

        try {
            $response = $this->client->request($this, 'get', $args, array(), $query);
        } catch(Exception $ex) {
            $this->dispatchException($ex);
        }

        return $this->transformResponse($response, $isCollection);
    }
1189044
public function create($args)
    {
        $data = null;
        if (is_object($args)) {
            if ($args instanceof DataItem) {
                $data = $args;
            } else {
                $args = get_object_vars($args);
            }
        } elseif (is_numeric($args)) {
            $args = array($this->getUniqueId() => intval($args));
        }
        return $data ? $data : new DataItem($args, $this->getUniqueId());
    }
258008
protected function parseArguments(array $args)
    {
        $output = [];

        foreach ($args as $arg) {
            if (is_string($arg) && strpos($arg, '@') === 0) {
                $service = substr($arg, 1);
                $output[] = $this->container->get($service);

                continue;
            }

            $output[] = $arg;
        }

        return $output;
    }
802097
public function read()
    {
        try {
            if ($this->rfs) {
                $json = $this->rfs->getContents($this->path, $this->path, false);
            } else {
                $json = file_get_contents($this->path);
            }
        } catch (TransportException $e) {
            throw new \RuntimeException($e->getMessage(), 0, $e);
        } catch (\Exception $e) {
            throw new \RuntimeException('Could not read '.$this->path."\n\n".$e->getMessage());
        }

        return static::parseJson($json, $this->path);
    }
611210
public static function dump(...$args)
    {
        ob_start();

        foreach ($args as $v) {
            var_dump($v);
        }

        $dump = ob_get_contents();
        ob_end_clean();

        return $dump;
    }
1346734
protected function parseArgs($args)
    {
        if (!is_array($args)) {
            return $args;
        }

        $this->silent = in_array('--silent', $args);
        if ($this->silent) {
            $args = array_values(array_diff($args, ['--silent']));
        }

        return $args;
    }
1146934
protected function _makeRequest($args = array()) {
        $date = date(DATE_RFC1123);
        $sig  = $this->_createSignature($date);
        $amznAuthHeader = 'AWS3-HTTPS '.
                            'AWSAccessKeyId='.$this->_accessKey.
                            ', Algorithm=Hmac'.strtoupper(self::SIGNATURE_HASH_METHOD).
                            ', Signature='.$sig;

        $client = $this->getHttpClient()->resetParameters();
        $endpoint = sprintf(self::ENDPOINT, $this->_region);
        $client->setUri($endpoint);
        $client->setHeaders(array(
            'Date' => $date,
            'X-Amzn-Authorization' => $amznAuthHeader
        ));

        // required parameters for each request
        $args['Signature'] = $sig;
        $args['SignatureMethod'] = 'Hmac'.self::SIGNATURE_HASH_METHOD;
        $args['SignatureVersion'] = 2;
        $args['Version'] = self::API_VERSION;

        $client->setParameterPost($args);
        $response = $client->request(Zend_Http_Client::POST);

        if ($response->getStatus() !== 200) {
            $this->throwException($response->getBody());
        }
        return $response->getBody();
    }
424487
public static function getInstance(...$args)
    {
        $class = static::class;

        if (empty(static::$instances[$class])) {
            static::$instances[$class] = Ioc::getContainer()->newInstance($class, ...$args);
        }

        return static::$instances[$class];
    }
324793
public static function decode(string $arg)
    {
        $s = $arg;
        $s = str_replace('-', '+', $s);
        $s = str_replace('_', '/', $s);

        switch (strlen($s) % 4) {
            case 0:
                break;
            case 2:
                $s .= "==";
                break;
            case 3:
                $s .= "=";
                break;
            default:
                throw new \Exception("Illegal base64url string!");
        }

        return base64_decode($s);
    }
388797
public function data($args)
    {
        foreach (func_get_args() as $arg) {
            if (is_array($arg)) {
                $this->data = array_merge_recursive($arg, $this->data);
            } else {
                $this->data[] = $arg;
            }
        }

        return $this;
    }
90574
private function read_from_file_or_stdin( $arg ) {
		if ( '-' !== $arg ) {
			$readfile = $arg;
			if ( ! file_exists( $readfile ) || ! is_file( $readfile ) ) {
				WP_CLI::error( "Unable to read content from '{$readfile}'." );
			}
		} else {
			$readfile = 'php://stdin';
		}
		return file_get_contents( $readfile );
	}
1351980
function get($key,$args=NULL) {
		if (is_string($val=$this->ref($key,FALSE)) && !is_null($args))
			return call_user_func_array(
				array($this,'format'),
				array_merge(array($val),is_array($args)?$args:array($args))
			);
		if (is_null($val)) {
			// Attempt to retrieve from cache
			if (Cache::instance()->exists($this->hash($key).'.var',$data))
				return $data;
		}
		return $val;
	}
944731
private function getItemId($args)
    {
        $entity = $args->getEntity();
        if ($entity instanceof Item) {
            return $entity->getId();
        }
        return null;
    }
208962
public static function browse( $args )
    {
        $nodeID = isset( $args[0] ) ? (int) $args[0] : 1;
        $offset = isset( $args[1] ) ? (int) $args[1] : 0;
        $limit  = isset( $args[2] ) ? (int) $args[2] : 10;
        $http   = eZHTTPTool::instance();

        if ( !$nodeID )
        {
            throw new ezcBaseFunctionalityNotSupportedException( 'Browse node list', 'Parent node id is not valid' );
        }

        $node = eZContentObjectTreeNode::fetch( $nodeID );
        if ( !$node instanceOf eZContentObjectTreeNode )
        {
            throw new ezcBaseFunctionalityNotSupportedException( 'Browse node list', "Parent node '$nodeID' is not valid" );
        }
        else if ( !$node->canRead() )
        {
            throw new ezcBaseFunctionalityNotSupportedException( 'Browse node list', "Parent node '$nodeID' is not valid" );
        }

        $params = array( 'Depth' => 1,
                'Limit'            => $limit,
                'Offset'           => $offset,
                'SortBy'           => $node->attribute( 'sort_array' ),
                'DepthOperator'    => 'eq',
                'AsObject'         => true
        );

        // Look for some (class filter and sort by) post params to use as fetch params
        if ( $http->hasPostVariable( 'ClassFilterArray' ) && $http->postVariable( 'ClassFilterArray' ) !== '' )
        {
            $params['ClassFilterType']  = 'include';
            $params['ClassFilterArray'] = $http->postVariable( 'ClassFilterArray' );
        }

        if ( $http->hasPostVariable( 'SortBy' ) && $http->postVariable( 'SortBy' ) !== '' )
        {
            $params['SortBy'] = $http->postVariable( 'SortBy' );
        }

        // fetch nodes and total node count
        $count = $node->subTreeCount( $params );
        if ( $count )
        {
            $nodeArray = $node->subTree( $params );
        }
        else
        {
            $nodeArray = false;
        }

        // generate json response from node list
        if ( $nodeArray )
        {
            $list = ezjscAjaxContent::nodeEncode(
                $nodeArray,
                array(
                    'fetchChildrenCount' => true,
                    'loadImages' => true,
                    'imagePreGenerateSizes' => array(
                        eZINI::instance( 'ezoe.ini' )->variable( 'EditorSettings', 'BrowseImageAlias' )
                    )
                ),
                'raw'
            );
        }
        else
        {
            $list = array();
        }

        return array(
            'list' => $list,
            'count' => count( $nodeArray ),
            'total_count' => (int) $count,
            'node' => ezjscAjaxContent::nodeEncode( $node, array('fetchPath' => true ), 'raw' ),
            'offset' => $offset,
            'limit' => $limit,
        );
    }
307858
public static function instance( $args = array() ) {
		if ( is_null( self::$instance ) ) {
			self::$instance = new self( $args );
		}

		return self::$instance;
	}
1262910
public function url( array $args = [] ) {
		$url = $this->siteurl;
		if ( $args ) {
			$url = add_query_arg( $args, $url );
		}

		return $url;
	}
88245
private function buildUrl($resource, $args)
    {
        //Merge args(apiKey, Format, noJsonCallback)
        $args = array_merge($args, $this->args);
        $query = http_build_query($args);

        $url = $this->url;
        $url .= $resource . '?' . $query;

        return $url;
    }