DuplicateKeyException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 4
1
<?php namespace CMPayments\JsonLint\Exceptions;
2
3
/**
4
 * Class DuplicateKeyException
5
 *
6
 * @package CMPayments\JsonLint\Exceptions
7
 */
8
class DuplicateKeyException extends JsonLintException
9
{
10
    const ERROR_PARSE_ERROR_DUPLICATE_KEY = 1;
11
12
    protected $messages = [
13
        self::ERROR_PARSE_ERROR_DUPLICATE_KEY => 'Parse error on line %d, duplicate key: %s'
14
    ];
15
16
    private $key = null;
17
18
    /**
19
     * ApiException constructor.
20
     *
21
     * @param string $code
22
     * @param array  $key
23
     * @param array  $args
24
     * @param null   $message
25
     */
26
    public function __construct($code, $key, $args = [], $message = null)
27
    {
28
        $this->key = $key;
29
30
        parent::__construct($code, $args, $message);
31
    }
32
33
    /**
34
     * @return mixed
35
     */
36
    public function getKey()
37
    {
38
        return $this->key;
39
    }
40
}
41