Completed
Pull Request — master (#526)
by Michael
01:57
created

TransactionException::getAlertType()   A

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
/**
4
 * Transaction Exception
5
 *
6
 * Raise this inside a transactionally() block and you'll terminate the
7
 * transaction and show an error message to the user.
8
 */
9
class TransactionException extends Exception
10
{
11
	private $title;
12
	private $alertType;
13
14
	/**
15
	 * @param string $message
16
	 * @param string $title
17
	 * @param string $alertType
18
	 * @param int $code
19
	 * @param null|Exception $previous
20
	 */
21 1
	public function __construct($message, $title = "Error occured during transaction", $alertType = "alert-error", $code = 0, Exception $previous = null)
22
	{
23 1
		$this->title = $title;
24 1
		$this->alertType = $alertType;
25 1
		parent::__construct($message, $code, $previous);
26 1
	}
27
28 1
	public function getTitle()
29
	{
30 1
		return $this->title;
31
	}
32
33 1
	public function getAlertType()
34
	{
35 1
		return $this->alertType;
36
	}
37
}
38