Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
4 / 4
CRAP
100.00% covered (success)
100.00%
1 / 1
InMemoryTransaction
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
4 / 4
4
100.00% covered (success)
100.00%
1 / 1
 inTransaction
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 begin
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 commit
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 rollback
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
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
8declare(strict_types=1);
9
10namespace Phexium\Plugin\Transaction\Adapter;
11
12use Override;
13use Phexium\Plugin\Transaction\Port\TransactionInterface;
14
15final class InMemoryTransaction implements TransactionInterface
16{
17    private bool $weStartedTransaction = false;
18
19    #[Override]
20    public function inTransaction(): bool
21    {
22        return $this->weStartedTransaction;
23    }
24
25    #[Override]
26    public function begin(): void
27    {
28        $this->weStartedTransaction = true;
29    }
30
31    #[Override]
32    public function commit(): void
33    {
34        $this->weStartedTransaction = false;
35    }
36
37    #[Override]
38    public function rollback(): void
39    {
40        $this->weStartedTransaction = false;
41    }
42}