applyCallbacks() public method

Apply all of the callbacks for this filter.
public applyCallbacks ( mixed $data = null, integer $offset ) : mixed
$data mixed
$offset integer
return mixed
Example #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);
 }