| Conditions | 3 |
| Paths | 2 |
| Total Lines | 11 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php namespace Arcanedev\Sanitizer\Filters; |
||
| 27 | 36 | public function filter($value, array $options = []) |
|
| 28 | { |
||
| 29 | 36 | if ( ! is_string($value) || empty(trim($value))) |
|
| 30 | 18 | return $value; |
|
| 31 | |||
| 32 | 36 | $this->checkOptions($options); |
|
| 33 | |||
| 34 | 27 | list($currentFormat, $targetFormat) = array_map('trim', $options); |
|
| 35 | |||
| 36 | 27 | return DateTime::createFromFormat($currentFormat, $value)->format($targetFormat); |
|
| 37 | } |
||
| 38 | |||
| 59 |