GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

YamlLoader::load()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 9

Duplication

Lines 14
Ratio 100 %

Code Coverage

Tests 8
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 14
loc 14
ccs 8
cts 8
cp 1
rs 9.4285
cc 2
eloc 9
nc 2
nop 0
crap 2
1
<?php
2
3
/**
4
 * This file is part of the m1\vars library
5
 *
6
 * (c) m1 <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * @package     m1/vars
12
 * @version     1.1.0
13
 * @author      Miles Croxford <[email protected]>
14
 * @copyright   Copyright (c) Miles Croxford <[email protected]>
15
 * @license     http://github.com/m1/vars/blob/master/LICENSE
16
 * @link        http://github.com/m1/vars/blob/master/README.MD Documentation
17
 */
18
19
namespace M1\Vars\Loader;
20
21
use Symfony\Component\Yaml\Yaml;
22
23
/**
24
 * The Yaml file loader
25
 *
26
 * @since 0.1.0
27
 */
28 View Code Duplication
class YamlLoader extends AbstractLoader
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
29
{
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public static $supported = array('yaml', 'yml');
34
35
    /**
36
     * {@inheritdoc}
37
     *
38
     * @throws \RuntimeException If `symfony/yaml` library is not installed or the file can not be parsed
39
     */
40 52
    public function load()
41
    {
42
        try {
43 52
            $this->content = Yaml::parse(file_get_contents($this->entity));
44 1
        } catch (\Exception $e) {
45 1
            throw new \RuntimeException(sprintf(
46 1
                "%s threw an exception: %s",
47 1
                $this->entity,
48 1
                $e
49
            ));
50
        }
51
52 51
        return $this;
53
    }
54
}
55