Passed
Pull Request — master (#5)
by Petr
04:44 queued 02:20
created

YourMembershipResponseException::__toString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 4
loc 4
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 View Code Duplication
class YourMembershipResponseException extends YourMembershipException
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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