50        parent::__construct(
$config, $reserved);
 
   52        assert(
'is_array($config)');
 
   58                if($value === 
'%replace') {
 
   59                    $this->replace = TRUE;
 
   60                } elseif ($value === 
'%remove') {
 
   69            if (
$name === 
'pattern') {
 
   70                $this->pattern = $value;
 
   74            if (
$name === 
'replacement') {
 
   75                $this->replacement = $value;
 
   79            if (
$name === 
'subject') {
 
   80                $this->subject = $value;
 
   84            if (
$name === 
'target') {
 
   85                $this->target = $value;
 
   99        assert(
'is_array($request)');
 
  100        assert(
'array_key_exists("Attributes", $request)');
 
  106        if (empty($this->pattern) || empty($this->subject)) {
 
  110        if (!$this->replace && !$this->
remove && $this->replacement === 
false) {
 
  112                "'%remove' are set.");
 
  115        if (!$this->replace && $this->replacement === 
null) {
 
  119        if ($this->replace && $this->
remove) {
 
  123        if (empty($this->target)) {
 
  128        if ($this->subject !== $this->target && $this->
remove) {
 
  132        if (!array_key_exists($this->subject, 
$attributes)) {
 
  137        if ($this->replace) { 
 
  140                if (preg_match($this->pattern, $value, $matches) > 0) {
 
  141                    $new_value = $matches[0];
 
  143                    if ($this->replacement !== FALSE) {
 
  147                    if ($this->subject === $this->target) {
 
  154        } elseif ($this->
remove) { 
 
  155            $removedAttrs = array();
 
  158                if (preg_match($this->pattern, $value, $matches) > 0) {
 
  159                    $removedAttrs[] = $value;
 
  168            if ($this->subject === $this->target) {
 
An exception for terminatinating execution or to throw for unit testing.
$target
Attribute to place the result in.
process(&$request)
Apply the filter to modify attributes.
$subject
Attribute to search in.
$remove
Should the value found be removed?
__construct($config, $reserved)
Initialize this filter.
$pattern
Pattern to search for.
$replace
Should the pattern found be replaced?
$replacement
String to replace the pattern found with.