Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
AbstractManager
n/a
0 / 0
n/a
0 / 0
0
n/a
0 / 0
 isTransaction
n/a
0 / 0
n/a
0 / 0
0
 getTransactionDepth
n/a
0 / 0
n/a
0 / 0
0
 enter
n/a
0 / 0
n/a
0 / 0
0
 leave
n/a
0 / 0
n/a
0 / 0
0
1<?php
2declare(strict_types=1);
3/**
4 * Pop PHP Framework (https://www.popphp.org/)
5 *
6 * @link       https://github.com/popphp/popphp-framework
7 * @author     Nick Sagona, III <nick@popphp.org>
8 * @copyright  Copyright (c) 2009-2026 Nick Sagona, III
9 * @license    https://www.popphp.org/license     New BSD License
10 */
11
12/**
13 * @namespace
14 */
15namespace Pop\Db\Adapter\Transaction;
16
17/**
18 * Db adapter transaction manager abstract class
19 *
20 * @category   Pop
21 * @package    Pop\Db
22 * @author     Nick Sagona, III <nick@popphp.org>
23 * @author     Martok <martok@martoks-place.de>
24 * @copyright  Copyright (c) 2009-2026 Nick Sagona, III
25 * @license    https://www.popphp.org/license     New BSD License
26 * @version    7.0.0
27 */
28abstract class AbstractManager implements ManagerInterface
29{
30
31    /**
32     * Check if adapter is in the middle of an open transaction
33     *
34     * @return bool
35     */
36    abstract public function isTransaction(): bool;
37
38    /**
39     * Get transaction depth
40     *
41     * @return int
42     */
43    abstract public function getTransactionDepth(): int;
44
45    /**
46     * Enter a new transaction or increase nesting level
47     *
48     * @param ?callable $beginFunc Called when a new top-level transaction must be started
49     * @param ?callable $savepointFunc Called when a named savepoint is created
50     * @return bool
51     */
52    abstract public function enter(?callable $beginFunc = null, ?callable $savepointFunc = null): bool;
53
54    /**
55     * Leave a transaction or reduce nesting level
56     *
57     * @param bool $doCommit If true, perform a commit. Rollback otherwise.
58     * @param ?callable $commitFunc Called when a top-level commit must be performed
59     * @param ?callable $rollbackFunc Called when a top-level rollback must be performed
60     * @param ?callable $savepointReleaseFunc Called when a savepoint is released (like commit)
61     * @param ?callable $savepointRollbackFunc Called when the transaction is rolled back to a savepoint
62     * @return bool
63     */
64    abstract public function leave(bool      $doCommit,
65                          ?callable $commitFunc = null, ?callable $rollbackFunc = null,
66                          ?callable $savepointReleaseFunc = null, ?callable $savepointRollbackFunc = null): bool;
67
68}