YamlDecoder   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 14
ccs 4
cts 4
cp 1
rs 10
c 1
b 0
f 1
wmc 2
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A decode() 0 8 2
1
<?php
2
3
namespace League\JsonReference\Decoder;
4
5
use League\JsonReference\DecoderInterface;
6
use League\JsonReference\DecodingException;
7
8
use Symfony\Component\Yaml\Exception\ParseException;
9
use Symfony\Component\Yaml\Yaml;
10
11
final class YamlDecoder implements DecoderInterface
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16 4
    public function decode($schema)
17
    {
18
        try {
19 4
            return Yaml::parse($schema, Yaml::PARSE_OBJECT_FOR_MAP | Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE);
20 2
        } catch (ParseException $e) {
21 2
            throw new DecodingException(sprintf('Invalid Yaml: %s', $e->getMessage()), $e->getCode(), $e);
22
        }
23
    }
24
}
25