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.

YamlFileLoader   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 26
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A load() 0 6 1
A supports() 0 10 3
1
<?php
2
/*
3
 * Copyright (c) 2015 Matthew Loberg
4
 * Distributed under the MIT License (http://opensource.org/licenses/MIT)
5
 */
6
7
namespace Mlo\FileLoader;
8
9
use Symfony\Component\Config\Loader\Loader;
10
use Symfony\Component\Yaml\Yaml;
11
12
/**
13
 * YamlFileLoader
14
 *
15
 * @author Matthew Loberg <[email protected]>
16
 */
17
class YamlFileLoader extends Loader
18
{
19
    /**
20
     * @inheritdoc
21
     */
22
    public function load($resource, $type = null)
23
    {
24
        $values = Yaml::parse(file_get_contents($resource));
25
26
        return $values;
27
    }
28
29
    /**
30
     * @inheritdoc
31
     */
32
    public function supports($resource, $type = null)
33
    {
34
        if (!is_string($resource)) {
35
            return false;
36
        }
37
38
        $extension = pathinfo($resource, PATHINFO_EXTENSION);
39
40
        return 'yaml' === $extension || 'yml' === $extension;
41
    }
42
}
43