Passed
Push — master ( 6e7a8b...a8bcd9 )
by Alessandro
03:35 queued 01:32
created

Response::validate()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 5
cts 5
cp 1
rs 9.9332
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TrelloCycleTime\Client\Message;
6
7
use TrelloCycleTime\Exception\InvalidJsonException;
8
9
class Response
10
{
11 2
    public static function validate($jsonString)
12
    {
13 2
        $json = json_decode($jsonString, true);
14
15 2
        if (json_last_error() !== JSON_ERROR_NONE) {
16 1
            throw new InvalidJsonException(json_last_error_msg(), json_last_error());
17
        }
18
19 1
        return $json;
20
    }
21
}