JsonParser   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A parse() 0 10 2
1
<?php declare(strict_types=1);
2
3
namespace HSkrasek\OpenAPI\Parsers;
4
5
use HSkrasek\OpenAPI\Exceptions\ParseException;
6
7
final class JsonParser implements ParserInterface
8
{
9
    /**
10
     * @inheritdoc
11
     */
12
    public function parse(string $schemaContent): \stdClass
13
    {
14
        $parsedSchema = \json_decode($schemaContent);
15
16
        if (json_last_error() !== JSON_ERROR_NONE) {
17
            throw new ParseException(json_last_error_msg());
18
        }
19
20
        return $parsedSchema;
21
    }
22
}
23