Passed
Push — master ( c423ac...6bd0a6 )
by Enjoys
10:06
created

YAML::parseFile()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 3
Bugs 1 Features 1
Metric Value
cc 2
eloc 5
c 3
b 1
f 1
nc 2
nop 1
dl 0
loc 7
ccs 5
cts 5
cp 1
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Enjoys\Config\Parse;
6
7
use Enjoys\Config\Parse;
8
use Symfony\Component\Yaml as Symfony;
9
10
/**
11
 * @see https://symfony.com/doc/current/components/yaml.htm
12
 * @psalm-suppress MixedReturnStatement, MixedInferredReturnType
13
 * @author Enjoys
14
 */
15
class YAML extends Parse
16
{
17
18
    /**
19
     * {@inheritDoc}
20
     */
21 4
    protected function parseString(string $input)
22
    {
23
        try {
24 4
            return Symfony\Yaml::parse($input, (int)$this->getOption('flags', 0));
25 1
        } catch (Symfony\Exception\ParseException $e) {
26 1
            $this->logger->error($e->getMessage());
27 1
            return null;
28
        }
29
    }
30
31
}
32