Conditions | 4 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | public static function nullableParam($value, int $type = \PDO::PARAM_STR, int $option = self::OPTION_EMPTY): array |
||
20 | { |
||
21 | if ($value === null) { |
||
22 | return [null, \PDO::PARAM_NULL]; |
||
23 | } |
||
24 | |||
25 | if ($value instanceof \DateTime) { |
||
26 | if ($option & static::OPTION_PREFER_DATE) { |
||
27 | return [DateHelper::mysqlDate($value), $type]; |
||
28 | } |
||
29 | |||
30 | return [DateHelper::mysqlDateTime($value), $type]; |
||
31 | } |
||
32 | |||
33 | return [$value, $type]; |
||
34 | } |
||
36 |