ApiResponseException::getErrors()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Speicher210\Fastbill\Api\Exception;
4
5
/**
6
 * Exception thrown when the API returns an error in the response.
7
 */
8
class ApiResponseException extends \RuntimeException
9
{
10
    /**
11
     * Errors in the API response.
12
     *
13
     * @var array
14
     */
15
    protected $errors = array();
16
17
    /**
18
     * Constructor.
19
     *
20
     * @param string $message The error message.
21
     * @param array $errors The errors in the API response.
22
     * @param \Exception $previous Previous exception.
23
     * @param integer $code The error code.
24
     */
25 18
    public function __construct($message, array $errors = array(), \Exception $previous = null, $code = 0)
26
    {
27 18
        parent::__construct($message, $code, $previous);
28
29 18
        $this->errors = $errors;
30 18
    }
31
32
    /**
33
     * Get the errors in the API response.
34
     *
35
     * @return array
36
     */
37
    public function getErrors()
38
    {
39
        return $this->errors;
40
    }
41
}
42