original_string: public function setData()
      {
          // Process a collection
          if ($this->resource instanceof Collection) {
              $this->data = [];
  
              foreach ($this->resource->getData() as $resource) {
                  $this->parseItem(new Item($resource, $this->resource->getTransformer()));
              }
          }
  
          // Process an item
          elseif ($this->resource instanceof Item) {
              $this->parseItem($this->resource);
          }
  
          return $this;
      }
code: public function setData()
      {
          // Process a collection
          if ($this->resource instanceof Collection) {
              $this->data = [];
  
              foreach ($this->resource->getData() as $resource) {
                  $this->parseItem(new Item($resource, $this->resource->getTransformer()));
              }
          }
  
          // Process an item
          elseif ($this->resource instanceof Item) {
              $this->parseItem($this->resource);
          }
  
          return $this;
      }
code_tokens: public function setData ( ) { // Process a collection if ( $ this -> resource instanceof Collection ) { $ this -> data = [ ] ; foreach ( $ this -> resource -> getData ( ) as $ resource ) { $ this -> parseItem ( new Item ( $ resource , $ this -> resource -> getTransformer ( ) ) ) ; } } // Process an item elseif ( $ this -> resource instanceof Item ) { $ this -> parseItem ( $ this -> resource ) ; } return $ this ; }
docstring: Creates the response
  
  @return $this Instance of self
docstring_tokens: Creates the response