Inheritance: implements Airship\Engine\Contract\Security\FilterInterface
Ejemplo n.º 1
0
 /**
  * Apply all of the callbacks for this filter.
  *
  * @param mixed $data
  * @param int $offset
  * @return mixed
  * @throws \TypeError
  */
 public function applyCallbacks($data = null, int $offset = 0)
 {
     if ($offset === 0) {
         if (!empty($this->pattern)) {
             if (!\preg_match($this->pattern, $data)) {
                 throw new \TypeError(\sprintf('Pattern match failed (%s).', $this->index));
             }
         }
         return parent::applyCallbacks($data, 0);
     }
     return parent::applyCallbacks($data, $offset);
 }
Ejemplo n.º 2
0
 /**
  * Set the default value (not applicable to booleans)
  *
  * @param mixed $value
  * @return FilterInterface
  * @throws UnsupportedOperation
  */
 public function setDefault($value) : FilterInterface
 {
     return parent::setDefault($value);
 }