InvalidJson::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
crap 1
1
<?php
2
3
namespace PhMap\Exception;
4
5
use \PhMap\Exception;
6
7
/**
8
 * Class InvalidJson
9
 * @package PhMap\Exception
10
 */
11
class InvalidJson extends Exception {
12
13
    /**
14
     * @var string
15
     */
16
    private $json;
17
18
    /**
19
     * @return string
20
     */
21 1
    public function getJson() {
22 1
        return $this->json;
23
    }
24
25
    /**
26
     * @param string $json
27
     * @return $this
28
     */
29 1
    public function setJson($json) {
30 1
        $this->json = $json;
31
32 1
        return $this;
33
    }
34
35
    /**
36
     * @param string $json
37
     */
38 1
    public function __construct($json) {
39 1
        $this->setJson($json);
40
41 1
        $message = 'Json "' . $this->getJson() . '" is invalid';
42
43 1
        parent::__construct($message);
44 1
    }
45
46
}