| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3.0123 |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | 20 | public function preparedStatements(string $query): PDOStatement |
|
| 26 | { |
||
| 27 | 20 | $statement = $this->preparedStatements[$query] ?? null; |
|
| 28 | 20 | if ($statement instanceof PDOStatement) { |
|
| 29 | 9 | return $statement; |
|
| 30 | } |
||
| 31 | |||
| 32 | 20 | $statement = $this->pdo->prepare($query); |
|
| 33 | 20 | if (false === $statement) { |
|
| 34 | throw new \LogicException("Cannot prepare the statement: $query"); |
||
| 35 | } |
||
| 36 | 20 | $this->preparedStatements[$query] = $statement; |
|
| 37 | |||
| 38 | 20 | return $statement; |
|
|
|
|||
| 39 | } |
||
| 63 |