ApiResponseException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 34
ccs 4
cts 6
cp 0.6667
rs 10
c 0
b 0
f 0

2 Methods

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