JsonErrorException   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
dl 0
loc 35
c 0
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
1
<?php
2
3
namespace Amelia\Monzo\Exceptions;
4
5
class JsonErrorException extends MonzoException
6
{
7
    /**
8
     * The raw input given to json_decode.
9
     *
10
     * @var mixed
11
     */
12
    public $raw;
13
14
    /**
15
     * The raw error from {@see json_last_error_msg()}.
16
     *
17
     * @var string
18
     */
19
    public $error;
20
21
    /**
22
     * The status message for this error.
23
     *
24
     * @var int
25
     */
26
    protected static $status = 500;
27
28
    /**
29
     * JsonErrorException constructor.
30
     *
31
     * @param string $error
32
     * @param mixed $raw
33
     */
34
    public function __construct(string $error, $raw)
35
    {
36
        $this->raw = $raw;
37
        $this->error = $error;
38
39
        parent::__construct("{$this->error}\nraw body: {$this->raw}");
40
    }
41
}
42