Conditions | 4 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | 5 | public static function dateToCarbon($date) |
|
17 | { |
||
18 | 5 | if ($date instanceof Carbon) { |
|
19 | 1 | return $date; |
|
20 | } |
||
21 | |||
22 | 4 | if (is_string($date)) { |
|
23 | 2 | return static::dateFromString($date); |
|
24 | } |
||
25 | |||
26 | 2 | if ($date instanceof DateTime) { |
|
27 | 1 | return Carbon::parse($date->format('r')); |
|
28 | } |
||
29 | |||
30 | 1 | return null; |
|
31 | } |
||
32 | |||
50 |