Exception   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getErrors() 0 4 1
1
<?php
2
3
namespace Communibase;
4
5
/**
6
 * Class Exception
7
 *
8
 * @package Communibase
9
 * @author Kingsquare ([email protected])
10
 * @copyright Copyright (c) Kingsquare BV (http://www.kingsquare.nl)
11
 * @license http://opensource.org/licenses/MIT The MIT License (MIT)
12
 */
13
class Exception extends \Exception
14
{
15
    /**
16
     * a defined constant when the API is is invalid (or empty)
17
     */
18
    const INVALID_API_KEY = 0;
19
20
    /**
21
     * @var array
22
     */
23
    private $errors;
24
25
    /**
26
     * Overloaded to allow specific errors given by the API back to the handler
27
     * @inherit
28
     *
29
     * @param null|string $message
30
     * @param int $code
31
     * @param \Exception $previous
32
     * @param array $errors
33
     */
34
    public function __construct($message = null, $code = 0, \Exception $previous = null, array $errors = [])
35
    {
36
        $this->errors = $errors;
37
        parent::__construct($message, $code, $previous);
38
    }
39
40
    /**
41
     * @return array
42
     */
43
    public function getErrors()
44
    {
45
        return $this->errors;
46
    }
47
}
48