Passed
Push — develop-3.3.x ( 5a7b5f...c85e2c )
by Mario
02:35
created

transaction_exception::set_errors()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
/**
3
 *
4
 * PayPal Donation extension for the phpBB Forum Software package.
5
 *
6
 * @copyright (c) 2015-2024 Skouat
7
 * @license GNU General Public License, version 2 (GPL-2.0)
8
 *
9
 */
10
11
namespace skouat\ppde\exception;
12
13
class transaction_exception extends \Exception
14
{
15
	/**
16
	 * @var array
17
	 */
18
	private $errors;
19
20
	/**
21
	 * transaction_exception constructor.
22
	 *
23
	 * @param array           $errors   An array of error messages
24
	 * @param int             $code     The Exception code
25
	 * @param \Throwable|null $previous The previous throwable used for the exception chaining
26
	 */
27
	public function __construct(array $errors = [], $code = 0, \Throwable $previous = null)
28
	{
29
		parent::__construct(implode("\n", $errors), $code, $previous);
30
		$this->errors = $errors;
31
	}
32
33
	/**
34
	 * @return array
35
	 */
36
	public function get_errors(): array
37
	{
38
		return $this->errors;
39
	}
40
}
41