Пример #1
0
 /**
  * @param int    $comparisonType
  * @param string $value
  *
  * @return array
  */
 protected function getValueParts($comparisonType, $value)
 {
     return array_map(function ($val) use($comparisonType) {
         return parent::parseValue($comparisonType, $val);
     }, $this->tokenizer->tokenize($value, $this->ds->getDatabasePlatform()));
 }
 /**
  * Creates a new instance of a filter based on a configuration
  * of a filter registered in this manager with the given name
  *
  * @param string $name   A filter name
  * @param array  $params An additional parameters of a new filter
  *
  * @return FilterInterface
  * @throws \Exception
  */
 public function createFilter($name, array $params = null)
 {
     $defaultParams = ['type' => $name];
     if ($params !== null && !empty($params)) {
         $params = array_merge($defaultParams, $params);
     }
     switch ($name) {
         case 'string':
             $filter = new StringFilter($this->formFactory, new FilterUtility());
             break;
         default:
             throw new \Exception(sprintf('Not implemented in this test filter: "%s" . ', $name));
     }
     $filter->init($name, $params);
     return $filter;
 }