Conditions | 4 |
Paths | 4 |
Total Lines | 18 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
36 | public function __invoke($value) |
||
37 | { |
||
38 | $dateValue = &$value[$this->fieldName]; |
||
39 | |||
40 | if ($dateValue === null) { |
||
41 | if($this->allowNulls == false){ |
||
42 | throw new RuntimeException('Input must be DateTime object.'); |
||
43 | }else{ |
||
44 | $dateValue = null; |
||
45 | } |
||
46 | }else { |
||
47 | if (!($dateValue instanceof DateTime)) { |
||
48 | throw new RuntimeException('Input must be DateTime object.'); |
||
49 | } |
||
50 | |||
51 | $dateValue = $dateValue->format($this->format); |
||
52 | } |
||
53 | return $value; |
||
54 | } |
||
56 |