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