public function filter($value)
    {
        if (!is_scalar($value) && !is_array($value)) {
            return $value;
        }

        if ($this->options['pattern'] === null) {
            throw new Exception\RuntimeException(sprintf(
                'Filter %s does not have a valid pattern set',
                get_class($this)
            ));
        }

        return preg_replace($this->options['pattern'], $this->options['replacement'], $value);
    }
public function filter($value)
    {
        if (!is_scalar($value) && !is_array($value)) {
            return $value;
        }

        if ($this->options['pattern'] === null) {
            throw new Exception\RuntimeException(sprintf(
                'Filter %s does not have a valid pattern set',
                get_class($this)
            ));
        }

        return preg_replace($this->options['pattern'], $this->options['replacement'], $value);
    }
public function filter ( $ value ) { if ( ! is_scalar ( $ value ) && ! is_array ( $ value ) ) { return $ value ; } if ( $ this -> options [ 'pattern' ] === null ) { throw new Exception \ RuntimeException ( sprintf ( 'Filter %s does not have a valid pattern set' , get_class ( $ this ) ) ) ; } return preg_replace ( $ this -> options [ 'pattern' ] , $ this -> options [ 'replacement' ] , $ value ) ; }
Perform regexp replacement as filter

@param  mixed $value
@return mixed
@throws Exception\RuntimeException
Perform regexp replacement as filter