| Total Complexity | 6 |
| Total Lines | 49 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | trait HandlesDatabaseTransactions |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * Determines whether class uses transaction. |
||
| 13 | * |
||
| 14 | * @var bool |
||
| 15 | */ |
||
| 16 | protected bool $useTransaction = false; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Begin the transaction if enabled. |
||
| 20 | * |
||
| 21 | * @return void |
||
| 22 | */ |
||
| 23 | 20 | protected function beginTransaction(): void |
|
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Commit the transaction if enabled. |
||
| 34 | * |
||
| 35 | * @return void |
||
| 36 | */ |
||
| 37 | 12 | protected function commitTransaction(): void |
|
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * Rollback the transaction if enabled. |
||
| 48 | * |
||
| 49 | * @return void |
||
| 50 | */ |
||
| 51 | 4 | protected function rollbackTransaction(): void |
|
| 60 |