RequestFailed   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A getErrorCode() 0 4 1
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