Completed
Pull Request — master (#38)
by
unknown
04:11
created

JsonDecodeException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 4
dl 0
loc 5
ccs 0
cts 5
cp 0
crap 2
rs 9.4285
c 1
b 0
f 0
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
    public function __construct($message = "", $code = 0, Throwable $previous = null, $json)
0 ignored issues
show
introduced by
Function has parameters but no doc block
Loading history...
Coding Style introduced by
Parameters which have default values should be placed at the end.

If you place a parameter with a default value before a parameter with a default value, the default value of the first parameter will never be used as it will always need to be passed anyway:

// $a must always be passed; it's default value is never used.
function someFunction($a = 5, $b) { }
Loading history...
27
    {
28
        parent::__construct($message, $code, $previous);
29
        $this->json = $json;
30
    }
31
32
    /**
33
     * @return string
34
     */
35
    public function getJson()
36
    {
37
        return $this->json;
38
    }
39
}