public function get()
    {
        $uri = null;
        if ($this->context) {
            $uri = $this->context->getBaseUri() . '/';
        }
        $uri .= $this->params['endpoint'];
        
        $uri .= sprintf("?page=%d&perpage=%d"
            , $this->page
            , $this->perpage
            );
        
        // add filter if value is not empty
        foreach ($this->filters as $filter) {
            if (! empty($filter['value'])) {
                $uri .= sprintf("&%s=%s"
                    , $filter['field']
                    , rawurlencode($filter['value'])
                    );
            }
        }
        
        $res = $this->client->call($uri);

        // get and preserve pagination
        $lr = Client::getLastResponse();
        $this->pagination = isset($lr['body']) && isset($lr['body']['pagination']) ? $lr['body']['pagination'] : [];
        
        // convert array to Entities collection
        $this->data = [];
        foreach ($res as $data) {
            $this->data[] = (new Entity([], $this->client))->setData($data);
        }
        $this->current = 0;
        
        return $this->data;
    }
public function get()
    {
        $uri = null;
        if ($this->context) {
            $uri = $this->context->getBaseUri() . '/';
        }
        $uri .= $this->params['endpoint'];
        
        $uri .= sprintf("?page=%d&perpage=%d"
            , $this->page
            , $this->perpage
            );
        
        // add filter if value is not empty
        foreach ($this->filters as $filter) {
            if (! empty($filter['value'])) {
                $uri .= sprintf("&%s=%s"
                    , $filter['field']
                    , rawurlencode($filter['value'])
                    );
            }
        }
        
        $res = $this->client->call($uri);

        // get and preserve pagination
        $lr = Client::getLastResponse();
        $this->pagination = isset($lr['body']) && isset($lr['body']['pagination']) ? $lr['body']['pagination'] : [];
        
        // convert array to Entities collection
        $this->data = [];
        foreach ($res as $data) {
            $this->data[] = (new Entity([], $this->client))->setData($data);
        }
        $this->current = 0;
        
        return $this->data;
    }
public function get ( ) { $ uri = null ; if ( $ this -> context ) { $ uri = $ this -> context -> getBaseUri ( ) . '/' ; } $ uri .= $ this -> params [ 'endpoint' ] ; $ uri .= sprintf ( "?page=%d&perpage=%d" , $ this -> page , $ this -> perpage ) ; // add filter if value is not empty foreach ( $ this -> filters as $ filter ) { if ( ! empty ( $ filter [ 'value' ] ) ) { $ uri .= sprintf ( "&%s=%s" , $ filter [ 'field' ] , rawurlencode ( $ filter [ 'value' ] ) ) ; } } $ res = $ this -> client -> call ( $ uri ) ; // get and preserve pagination $ lr = Client :: getLastResponse ( ) ; $ this -> pagination = isset ( $ lr [ 'body' ] ) && isset ( $ lr [ 'body' ] [ 'pagination' ] ) ? $ lr [ 'body' ] [ 'pagination' ] : [ ] ; // convert array to Entities collection $ this -> data = [ ] ; foreach ( $ res as $ data ) { $ this -> data [ ] = ( new Entity ( [ ] , $ this -> client ) ) -> setData ( $ data ) ; } $ this -> current = 0 ; return $ this -> data ; }
Get current data
@return array
Get current data