Esempio n. 1
0
 /**
  * @param array|string $filters
  * @return $this
  * @throws \InvalidArgumentException
  */
 public function apply($filters)
 {
     if (is_string($filters)) {
         $filters = Utils\Helper::convertFilter($filters);
     }
     if (!is_array($filters)) {
         throw new \InvalidArgumentException("filters must be an array or a text string. ");
     }
     foreach ($filters as $rule => $parameter) {
         if (is_numeric($rule)) {
             $rule = $parameter;
             $parameter = true;
         }
         $this->filter[$rule] = $parameter;
     }
     return $this;
 }
Esempio n. 2
0
 /**
  * @param ValueTO $v
  * @param         $p
  */
 public function filter_kanaType($v, $p)
 {
     $option = Helper::arrGet($this->kanaType, $p, $p);
     if (!preg_match("/^{$option}\$/u", $v->getValue())) {
         $v->setError(__METHOD__, $p);
     }
 }