Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
5 / 5 |
|
100.00% |
5 / 5 |
CRAP | |
100.00% |
1 / 1 |
| SqlTransaction | |
100.00% |
5 / 5 |
|
100.00% |
5 / 5 |
5 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| inTransaction | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| begin | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| commit | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| rollback | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | // ╔════════════════════════════════════════════════════════════╗ |
| 4 | // ║ MIT Licence (#Expat) - https://opensource.org/licenses/MIT ║ |
| 5 | // ║ Copyright 2026 Frederic Poeydomenge <dyno@phexium.com> ║ |
| 6 | // ╚════════════════════════════════════════════════════════════╝ |
| 7 | |
| 8 | declare(strict_types=1); |
| 9 | |
| 10 | namespace Phexium\Plugin\Transaction\Internal; |
| 11 | |
| 12 | use Override; |
| 13 | use PDO; |
| 14 | use Phexium\Plugin\Transaction\Port\TransactionInterface; |
| 15 | |
| 16 | abstract readonly class SqlTransaction implements TransactionInterface |
| 17 | { |
| 18 | public function __construct( |
| 19 | private PDO $pdo |
| 20 | ) {} |
| 21 | |
| 22 | #[Override] |
| 23 | public function inTransaction(): bool |
| 24 | { |
| 25 | return $this->pdo->inTransaction(); |
| 26 | } |
| 27 | |
| 28 | #[Override] |
| 29 | public function begin(): void |
| 30 | { |
| 31 | $this->pdo->beginTransaction(); |
| 32 | } |
| 33 | |
| 34 | #[Override] |
| 35 | public function commit(): void |
| 36 | { |
| 37 | $this->pdo->commit(); |
| 38 | } |
| 39 | |
| 40 | #[Override] |
| 41 | public function rollback(): void |
| 42 | { |
| 43 | $this->pdo->rollBack(); |
| 44 | } |
| 45 | } |