Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
22 | public function apply($value, $options = []) |
||
23 | { |
||
24 | if (! $value) { |
||
25 | return $value; |
||
26 | } |
||
27 | |||
28 | if (count($options) != 2) { |
||
29 | throw new InvalidArgumentException('The Sanitizer Format Date filter requires both the current date format as well as the target format.'); |
||
30 | } |
||
31 | |||
32 | $currentFormat = trim($options[0]); |
||
33 | $targetFormat = trim($options[1]); |
||
34 | |||
35 | return Carbon::createFromFormat($currentFormat, $value)->format($targetFormat); |
||
36 | } |
||
37 | } |
||
38 |