original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: Get current data
  @return array
docstring_tokens: Get current data