Completed
Push — master ( f95e19...31ed8c )
by Dragos
13:13
created

ApiResponseException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

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;
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
    public function __construct($message, array $errors = array(), \Exception $previous = null, $code = 0)
26
    {
27
        parent::__construct($message, $code, $previous);
28
29
        $this->errors = $errors;
30
    }
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