| Conditions | 9 |
| Paths | 9 |
| Total Lines | 25 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 14.8607 |
| Changes | 0 | ||
| 1 | <?php |
||
| 38 | protected function internalExecute(string|null $rawSql): void |
||
| 39 | { |
||
| 40 | $attempt = 0; |
||
| 41 | |||
| 42 | while (true) { |
||
| 43 | try { |
||
| 44 | 221 | if ( |
|
| 45 | ++$attempt === 1 |
||
| 46 | 221 | && $this->isolationLevel !== null |
|
| 47 | && $this->db->getTransaction() === null |
||
| 48 | 221 | ) { |
|
| 49 | $this->db->transaction( |
||
| 50 | fn (string $rawSql) => $this->internalExecute($rawSql), |
||
| 51 | $this->isolationLevel |
||
| 52 | 221 | ); |
|
| 53 | 221 | } else { |
|
| 54 | $this->pdoStatement?->execute(); |
||
| 55 | } |
||
| 56 | break; |
||
| 57 | } catch (PDOException $e) { |
||
| 58 | $rawSql = $rawSql ?: $this->getRawSql(); |
||
| 59 | $e = (new ConvertException($e, $rawSql))->run(); |
||
| 60 | 221 | ||
| 61 | if ($this->retryHandler === null || !($this->retryHandler)($e, $attempt)) { |
||
| 62 | 220 | throw $e; |
|
| 63 | 6 | } |
|
| 68 |