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