YamlClassMetadataLoader::loadFile()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
c 0
b 0
f 0
ccs 4
cts 4
cp 1
rs 10
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
/*
4
 * This file is part of the Ivory Serializer package.
5
 *
6
 * (c) Eric GELOEN <[email protected]>
7
 *
8
 * For the full copyright and license information, please read the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Ivory\Serializer\Mapping\Loader;
13
14
use Symfony\Component\Yaml\Exception\ParseException;
15
use Symfony\Component\Yaml\Yaml;
16
17
/**
18
 * @author GeLo <[email protected]>
19
 */
20
class YamlClassMetadataLoader extends AbstractFileClassMetadataLoader
21
{
22
    /**
23
     * {@inheritdoc}
24
     */
25 464
    protected function loadFile($file)
26
    {
27
        try {
28 464
            return Yaml::parse(file_get_contents($file));
29 8
        } catch (ParseException $e) {
30 8
            throw new \InvalidArgumentException($e->getMessage(), $e->getCode(), $e);
31
        }
32
    }
33
}
34