YamlReader::readRaw()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 7
ccs 0
cts 4
cp 0
rs 10
cc 2
nc 2
nop 1
crap 6
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Composer\Config\Reader;
6
7
use Symfony\Component\Yaml\Yaml;
8
use Yiisoft\Composer\Config\Exception\UnsupportedFileTypeException;
9
10
/**
11
 * YamlReader - reads YAML files.
12
 */
13
class YamlReader extends AbstractReader
14
{
15
    protected function readRaw(string $path)
16
    {
17
        if (!class_exists(Yaml::class)) {
18
            throw new UnsupportedFileTypeException("For YAML support require `symfony/yaml` in your composer.json (reading $path)");
19
        }
20
21
        return Yaml::parse($this->getFileContents($path));
22
    }
23
}
24