RequestFailed::getErrorCode()   A
last analyzed

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
    /**
13
     * RequestFailed constructor.
14
     *
15
     * @param string          $message
16
     * @param string          $errorCode
17
     * @param \Exception|null $previous
18
     */
19
    public function __construct($message, $errorCode = null, \Exception $previous = null)
20
    {
21
        // Since the error code is generally a string, we store it in a local property
22
        // rather than passing it on to the parent constructor, which expects an integer.
23
        $this->errorCode = $errorCode;
24
25
        parent::__construct($message, 0, $previous);
26
    }
27
28
    /**
29
     * Returns the error code string.
30
     */
31
    public function getErrorCode()
32
    {
33
        return $this->errorCode;
34
    }
35
}
36