original_string: public function apply(Builder $builder)
      {
          $sortMethod = 'sort' . studly_case($this->getField());
  
          if(method_exists($builder->getModel(), $sortMethod)) {
              call_user_func_array([$builder->getModel(), $sortMethod], [$builder, $this->getOrder()]);
          } else {
              $builder->orderBy($this->getField(), $this->getOrder());
          }
      }
code: public function apply(Builder $builder)
      {
          $sortMethod = 'sort' . studly_case($this->getField());
  
          if(method_exists($builder->getModel(), $sortMethod)) {
              call_user_func_array([$builder->getModel(), $sortMethod], [$builder, $this->getOrder()]);
          } else {
              $builder->orderBy($this->getField(), $this->getOrder());
          }
      }
code_tokens: public function apply ( Builder $ builder ) { $ sortMethod = 'sort' . studly_case ( $ this -> getField ( ) ) ; if ( method_exists ( $ builder -> getModel ( ) , $ sortMethod ) ) { call_user_func_array ( [ $ builder -> getModel ( ) , $ sortMethod ] , [ $ builder , $ this -> getOrder ( ) ] ) ; } else { $ builder -> orderBy ( $ this -> getField ( ) , $ this -> getOrder ( ) ) ; } }
docstring: Applies criterion to query.
  
  @param Builder $builder query builder
docstring_tokens: Applies criterion to query .