Passed
Push — master ( 6e6484...b0e8a3 )
by
unknown
39s
created

getApiMethodName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
namespace P2A\YourMembership\Exceptions;
3
4
/**
5
 * This is an exception that is thrown when an error occurs with the API responses.
6
 */
7
class YourMembershipResponseException extends YourMembershipException
8
{
9
	/**
10
	 * Api Method That is related to this exception
11
	 * @var string
12
	 */
13
	private $apiMethod;
14
15 3
	public function __construct(string $message, int $code = 0, string $apiMethod, \Exception $e = null)
16
	{
17 3
		$this->apiMethod = $apiMethod;
18 3
		parent::__construct($message, $code, $e);
19 3
	}
20
21
	/**
22
	 * Returns the APi Method Name
23
	 * @method getApiMethodName
24
	 * @author PA
25
	 * @date   2017-01-12
26
	 * @return string
27
	 */
28 1
	public function getApiMethodName() : string {
29 1
		return $this->apiMethod;
30
	}
31
32 1
	public function __toString()
33
	{
34 1
	   return __CLASS__ . ": [{$this->apiMethod}]: {$this->message}\n";
35
	}
36
37
}
38