JsonDecodeException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 2
b 0
f 0
nc 1
nop 4
dl 0
loc 4
rs 10
ccs 0
cts 4
cp 0
crap 2
1
<?php
2
3
/*
4
 * This file is part of Guzzle HTTP JSON-RPC
5
 *
6
 * Copyright (c) 2014 Nature Delivered Ltd. <http://graze.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * @see  http://github.com/graze/guzzle-jsonrpc/blob/master/LICENSE
12
 * @link http://github.com/graze/guzzle-jsonrpc
13
 */
14
15
namespace Graze\GuzzleHttp\JsonRpc\Exception;
16
17
use Throwable;
18
19
class JsonDecodeException extends \InvalidArgumentException
20
{
21
    /**
22
     * @var string
23
     */
24
    private $json;
25
26
    /**
27
     * @param string        $message    The Exception message to throw
28
     * @param int           $code       The Exception code
29
     * @param Throwable     $previous   The previous throwable used for the exception chaining
30
     * @param string        $json       The JSON data.
31
     */
32
    public function __construct($message = "", $code = 0, Throwable $previous = null, $json = "")
33
    {
34
        parent::__construct($message, $code, $previous);
35
        $this->json = $json;
36
    }
37
38
    /**
39
     * @return string
40
     */
41
    public function getJson()
42
    {
43
        return $this->json;
44
    }
45
}
46