Completed
Push — master ( c56f94...60d510 )
by Tomáš
9s
created

YamlAndNeonParser   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A decode() 0 8 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of Symplify
7
 * Copyright (c) 2016 Tomas Votruba (http://tomasvotruba.cz).
8
 */
9
10
namespace Symplify\PHP7_Sculpin\Configuration\Parser;
11
12
use Nette\Neon\Neon;
13
use Symfony\Component\Yaml\Yaml;
14
use Throwable;
15
16
final class YamlAndNeonParser
17
{
18 6
    public function decode(string $content) : array
19
    {
20
        try {
21 6
            return Neon::decode($content);
22 3
        } catch (Throwable $throwable) {
23 3
            return  Yaml::parse($content);
24
        }
25
    }
26
}
27