original_string: public function addSearchOperator($name, $handler, array $options = [])
      {
          $name = Inflector::underscore($name);
          $operator = [
              'name' => $name,
              'handler' => false,
              'options' => [],
          ];
  
          if (is_string($handler)) {
              if (method_exists($this->_table, $handler)) {
                  $operator['handler'] = $handler;
              } else {
                  list($plugin, $class) = pluginSplit($handler);
  
                  if ($plugin) {
                      $className = $plugin === 'Search' ? "Search\\Operator\\{$class}Operator" : "{$plugin}\\Model\\Search\\{$class}Operator";
                      $className = str_replace('OperatorOperator', 'Operator', $className);
                  } else {
                      $className = $class;
                  }
  
                  $operator['handler'] = $className;
                  $operator['options'] = $options;
              }
          } elseif (is_object($handler) || is_callable($handler)) {
              $operator['handler'] = $handler;
          }
  
          $this->config("operators.{$name}", $operator);
      }
code: public function addSearchOperator($name, $handler, array $options = [])
      {
          $name = Inflector::underscore($name);
          $operator = [
              'name' => $name,
              'handler' => false,
              'options' => [],
          ];
  
          if (is_string($handler)) {
              if (method_exists($this->_table, $handler)) {
                  $operator['handler'] = $handler;
              } else {
                  list($plugin, $class) = pluginSplit($handler);
  
                  if ($plugin) {
                      $className = $plugin === 'Search' ? "Search\\Operator\\{$class}Operator" : "{$plugin}\\Model\\Search\\{$class}Operator";
                      $className = str_replace('OperatorOperator', 'Operator', $className);
                  } else {
                      $className = $class;
                  }
  
                  $operator['handler'] = $className;
                  $operator['options'] = $options;
              }
          } elseif (is_object($handler) || is_callable($handler)) {
              $operator['handler'] = $handler;
          }
  
          $this->config("operators.{$name}", $operator);
      }
code_tokens: public function addSearchOperator ( $ name , $ handler , array $ options = [ ] ) { $ name = Inflector :: underscore ( $ name ) ; $ operator = [ 'name' => $ name , 'handler' => false , 'options' => [ ] , ] ; if ( is_string ( $ handler ) ) { if ( method_exists ( $ this -> _table , $ handler ) ) { $ operator [ 'handler' ] = $ handler ; } else { list ( $ plugin , $ class ) = pluginSplit ( $ handler ) ; if ( $ plugin ) { $ className = $ plugin === 'Search' ? "Search\\Operator\\{$class}Operator" : "{$plugin}\\Model\\Search\\{$class}Operator" ; $ className = str_replace ( 'OperatorOperator' , 'Operator' , $ className ) ; } else { $ className = $ class ; } $ operator [ 'handler' ] = $ className ; $ operator [ 'options' ] = $ options ; } } elseif ( is_object ( $ handler ) || is_callable ( $ handler ) ) { $ operator [ 'handler' ] = $ handler ; } $ this -> config ( "operators.{$name}" , $ operator ) ; }
docstring: Registers a new operator method.
  
  Allowed formats are:
  
  ```php
  $this->addSearchOperator('created', 'operatorCreated');
  ```
  
  The above will use Table's `operatorCreated()` method to handle the "created"
  operator.
  
  ---
  
  ```php
  $this->addSearchOperator('created', 'MyPlugin.Limit');
  ```
  
  The above will use `MyPlugin\Model\Search\LimitOperator` class to handle the
  "limit" operator. Note the `Operator` suffix.
  
  ---
  
  ```php
  $this->addSearchOperator('created', 'MyPlugin.Limit', ['my_option' => 'option_value']);
  ```
  
  Similar as before, but in this case you can provide some configuration
  options passing an array as above.
  
  ---
  
  ```php
  $this->addSearchOperator('created', 'Full\ClassName');
  ```
  
  Or you can indicate a full class name to use.
  
  ---
  
  ```php
  $this->addSearchOperator('created', function ($query, $token) {
  // scope $query
  return $query;
  });
  ```
  
  You can simply pass a callable function to handle the operator, this callable
  must return the altered $query object.
  
  ---
  
  ```php
  $this->addSearchOperator('created', new CreatedOperator($table, $options));
  ```
  
  In this case you can directly pass an instance of an operator handler,
  this object should extends the `Search\Operator` abstract class.
  
  @param string $name Underscored operator's name. e.g. `author`
  @param mixed $handler A valid handler as described above
  @return void
docstring_tokens: Registers a new operator method .