Passed
Push — master ( 63237f...7c0386 )
by Reüel
06:18 queued 10s
created

Error::get_title()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 2
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
/**
3
 * Mollie error.
4
 *
5
 * @author    Pronamic <[email protected]>
6
 * @copyright 2005-2019 Pronamic
7
 * @license   GPL-3.0-or-later
8
 * @package   Pronamic\WordPress\Pay
9
 */
10
11
namespace Pronamic\WordPress\Pay\Gateways\Mollie;
12
13
/**
14
 * Mollie error
15
 *
16
 * @link    https://docs.mollie.com/guides/handling-errors
17
 * @author  Remco Tolsma
18
 * @version 2.0.9
19
 * @since   2.0.9
20
 */
21
class Error extends \Exception {
22
	/**
23
	 * Status.
24
	 *
25
	 * @var int
26
	 */
27
	private $status;
28
29
	/**
30
	 * Title.
31
	 *
32
	 * @var string
33
	 */
34
	private $title;
35
36
	/**
37
	 * Detail.
38
	 *
39
	 * @var string
40
	 */
41
	public $detail;
42
43
	/**
44
	 * Construct Mollie error.
45
	 *
46
	 * @param int    $status Status.
47
	 * @param string $title  Title.
48
	 * @param string $detail Detail.
49
	 */
50 3
	public function __construct( $status, $title, $detail ) {
51 3
		$message = sprintf(
52 3
			'%s - %s',
53
			$title,
54
			$detail
55
		);
56
57 3
		parent::__construct( $message, $status );
58
59 3
		$this->status = $status;
60 3
		$this->title  = $title;
61 3
		$this->detail = $detail;
62 3
	}
63
64
	/**
65
	 * Get status.
66
	 *
67
	 * @return int
68
	 */
69
	public function get_status() {
70
		return $this->status;
71
	}
72
73
	/**
74
	 * Get title.
75
	 *
76
	 * @return string
77
	 */
78 3
	public function get_title() {
79 3
		return $this->title;
80
	}
81
82
	/**
83
	 * Get title.
84
	 *
85
	 * @return string
86
	 */
87 3
	public function get_detail() {
88 3
		return $this->detail;
89
	}
90
}
91