original_string: public function apply(Collection $collection)
      {
          $this->collection = $collection;
  
          foreach ($this->filters() as $name => $value) {
              if (! method_exists($this, $name)) {
                  continue;
              }
  
              if (is_array($value) or trim($value)) {
                  $this->collection = $this->$name($value);
              } else {
                  $this->collection = $this->$name();
              }
          }
  
          return $this->collection;
      }
code: public function apply(Collection $collection)
      {
          $this->collection = $collection;
  
          foreach ($this->filters() as $name => $value) {
              if (! method_exists($this, $name)) {
                  continue;
              }
  
              if (is_array($value) or trim($value)) {
                  $this->collection = $this->$name($value);
              } else {
                  $this->collection = $this->$name();
              }
          }
  
          return $this->collection;
      }
code_tokens: public function apply ( Collection $ collection ) { $ this -> collection = $ collection ; foreach ( $ this -> filters ( ) as $ name => $ value ) { if ( ! method_exists ( $ this , $ name ) ) { continue ; } if ( is_array ( $ value ) or trim ( $ value ) ) { $ this -> collection = $ this -> $ name ( $ value ) ; } else { $ this -> collection = $ this -> $ name ( ) ; } } return $ this -> collection ; }
docstring: Apply the filters to the collection.
  
  @param Collection $collection
  
  @return Collection
docstring_tokens: Apply the filters to the collection .