Conditions | 4 |
Paths | 4 |
Total Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
61 | public static function dateToDatetime($date): \DateTime |
||
62 | { |
||
63 | // DateTime |
||
64 | if ($date instanceof \DateTime) { |
||
65 | return $date; |
||
66 | } |
||
67 | // timestamp or AAAA-MM-DD |
||
68 | if (is_numeric($date)) { |
||
69 | return (new \DateTime())->setTimestamp($date); |
||
70 | } |
||
71 | // string (ie: '01/01/2019', 'today') |
||
72 | if (is_string($date)) { |
||
73 | return new \DateTime($date); |
||
74 | } |
||
75 | } |
||
76 | |||
98 |
This check examines a number of code elements and verifies that they conform to the given naming conventions.
You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.