| @@ 31-40 (lines=10) @@ | ||
| 28 | * |
|
| 29 | * @return bool True if the value was sanitized, false if not. |
|
| 30 | */ |
|
| 31 | public function __invoke($subject, string $field): bool |
|
| 32 | { |
|
| 33 | $value = $subject->$field; |
|
| 34 | if (!is_scalar($value)) { |
|
| 35 | return false; |
|
| 36 | } |
|
| 37 | $subject->$field = preg_replace($this->expr, $this->replace, $value); |
|
| 38 | ||
| 39 | return true; |
|
| 40 | } |
|
| 41 | } |
|
| 42 | ||
| @@ 26-36 (lines=11) @@ | ||
| 23 | * |
|
| 24 | * @return bool True if the value was sanitized, false if not. |
|
| 25 | */ |
|
| 26 | public function __invoke($subject, string $field): bool |
|
| 27 | { |
|
| 28 | $value = $subject->$field; |
|
| 29 | if (is_scalar($value) || $value === null) { |
|
| 30 | $subject->$field = trim($value, $this->chars); |
|
| 31 | ||
| 32 | return true; |
|
| 33 | } |
|
| 34 | ||
| 35 | return false; |
|
| 36 | } |
|
| 37 | } |
|
| 38 | ||