Conditions | 6 |
Paths | 9 |
Total Lines | 23 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | public static function bind(\PDOStatement &$stmt, array $params = []) |
||
12 | { |
||
13 | $defaultType = \PDO::PARAM_STR; |
||
14 | |||
15 | foreach ($params as $key => $value) { |
||
16 | $type = $defaultType; |
||
17 | |||
18 | if (is_int($value)) { |
||
19 | $type = \PDO::PARAM_INT; |
||
20 | } |
||
21 | |||
22 | if (is_resource($value)) { |
||
23 | $type = \PDO::PARAM_LOB; |
||
24 | } |
||
25 | |||
26 | if (is_bool($value)) { |
||
27 | $type = \PDO::PARAM_BOOL; |
||
28 | } |
||
29 | |||
30 | $stmt->bindValue( |
||
31 | is_string($key) ? $key : $key + 1, |
||
32 | $value, |
||
33 | $type |
||
34 | ); |
||
60 | } |