| Conditions | 8 |
| Paths | 8 |
| Total Lines | 25 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 8 |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | 3 | public function quote(\PDO $dbh, $value) |
|
| 22 | { |
||
| 23 | 3 | if (is_bool($value)) { |
|
| 24 | /** |
||
| 25 | * MySQL has true and false literals |
||
| 26 | * SQLite does not support boolean type nor literals |
||
| 27 | */ |
||
| 28 | 2 | if ($this->isMySQL($dbh)) { |
|
| 29 | 1 | return $value ? 'TRUE' : 'FALSE'; |
|
| 30 | } |
||
| 31 | |||
| 32 | 1 | return $value ? 1 : 0; |
|
| 33 | } |
||
| 34 | 1 | if ($value === null) { |
|
| 35 | 1 | return 'NULL'; |
|
| 36 | } |
||
| 37 | 1 | if (is_int($value)) { |
|
| 38 | 1 | return (int)$value; |
|
| 39 | } |
||
| 40 | 1 | if (is_float($value)) { |
|
| 41 | 1 | return (float)$value; |
|
| 42 | } |
||
| 43 | |||
| 44 | 1 | return $dbh->quote($value); |
|
| 45 | } |
||
| 46 | |||
| 66 |