DbTransactionHandler::begin()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Class for transaction management
4
 *
5
 * @file      DbTransactionHandler.php
6
 *
7
 * PHP version 8.0+
8
 *
9
 * @author    Alexander Yancharuk <alex at itvault dot info>
10
 * @copyright © 2012-2021 Alexander Yancharuk
11
 * @date      Срд Апр 23 06:34:47 MSK 2014
12
 * @license   The BSD 3-Clause License
13
 *            <https://tldrlegal.com/license/bsd-3-clause-license-(revised)>
14
 */
15
16
namespace Veles\DataBase;
17
18
/**
19
 * Class DbTransactionHandler
20
 *
21
 * Класс, содержащий функционал транзакций
22
 *
23
 * @author  Alexander Yancharuk <alex at itvault dot info>
24
 */
25
class DbTransactionHandler extends DbBase
26
{
27
	/**
28
	 * Transaction initialization
29
	 *
30
	 * @return bool
31
	 * @throws \Exception
32
	 */
33 1
	public static function begin()
34
	{
35 1
		return self::getAdapter()->begin();
36
	}
37
38
	/**
39
	 * Rollback transaction
40
	 *
41
	 * @return bool
42
	 * @throws \Exception
43
	 */
44 1
	public static function rollback()
45
	{
46 1
		return self::getAdapter()->rollback();
47
	}
48
49
	/**
50
	 * Apply all queries and close transaction
51
	 *
52
	 * @return bool
53
	 * @throws \Exception
54
	 */
55 1
	public static function commit()
56
	{
57 1
		return self::getAdapter()->commit();
58
	}
59
}
60