original_string: 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);
      }
code: 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);
      }
code_tokens: 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 ) ; }
docstring: Perform regexp replacement as filter
  
  @param  mixed $value
  @return mixed
  @throws Exception\RuntimeException
docstring_tokens: Perform regexp replacement as filter