| Conditions | 2 |
| Paths | 2 |
| Total Lines | 8 |
| Code Lines | 4 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 4 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 33 | 4 | public static function getDateString(\DateTime $dateTime = null, $noTime = false, $useTimezone = false, $useUtc = false) |
|
| 34 | { |
||
| 35 | 4 | if (empty($dateTime)) { |
|
| 36 | 2 | $dateTime = new \DateTime(); |
|
| 37 | } |
||
| 38 | |||
| 39 | 4 | return $dateTime->format(self::getDateFormat($noTime, $useTimezone, $useUtc)); |
|
| 40 | } |
||
| 41 | |||
| 61 |
If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe: