Test Failed
Push — master ( 45b675...c0597d )
by Dan Michael O.
02:21
created

RequestFailed::getErrorCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Scriptotek\Alma\Exception;
4
5
class RequestFailed extends ClientException
6
{
7
    /**
8
     * @var string
9
     */
10
    private $errorCode;
11
12
    public function __construct(string $message, string $errorCode = null, \Exception $previous = null)
13
    {
14
        // Since the error code is generally a string, we store it in a local property
15
        // rather than passing it on to the parent constructor, which expects an integer.
16
        $this->errorCode = $errorCode;
17
18
        parent::__construct($message, 0, $previous);
19
    }
20
21
    /**
22
     * Returns the error code string.
23
     */
24
    public function getErrorCode()
25
    {
26
        return $this->errorCode;
27
    }
28
}
29