Apply the filter to modify attributes.
Modify existing attributes with the configured values.
98 {
99 assert('is_array($request)');
100 assert('array_key_exists("Attributes", $request)');
101
102
104
105
106 if (empty($this->pattern) || empty($this->subject)) {
108 }
109
110 if (!$this->replace && !$this->remove && $this->replacement === false) {
112 "'%remove' are set.");
113 }
114
115 if (!$this->replace && $this->replacement === null) {
117 }
118
119 if ($this->replace && $this->remove) {
121 }
122
123 if (empty($this->target)) {
124
126 }
127
128 if ($this->subject !== $this->target && $this->remove) {
130 }
131
132 if (!array_key_exists($this->subject,
$attributes)) {
133
134 return;
135 }
136
137 if ($this->replace) {
139 $matches = array();
140 if (preg_match($this->pattern, $value, $matches) > 0) {
141 $new_value = $matches[0];
142
143 if ($this->replacement !== FALSE) {
145 }
146
147 if ($this->subject === $this->target) {
148 $value = $new_value;
149 } else {
151 }
152 }
153 }
154 } elseif ($this->remove) {
155 $removedAttrs = array();
157 $matches = array();
158 if (preg_match($this->pattern, $value, $matches) > 0) {
159 $removedAttrs[] = $value;
160 }
161 }
163
166 }
167 } else {
168 if ($this->subject === $this->target) {
171 } else {
175 }
176 }
177 }
$target
Attribute to place the result in.
$subject
Attribute to search in.
$replacement
String to replace the pattern found with.