Completed
Push — master ( b1b3d7...ed93a7 )
by Дмитрий
03:53
created

ConfigurationLoader::supports()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 2
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 4
ccs 0
cts 2
cp 0
crap 6
rs 10
1
<?php
2
/**
3
 * @author Patsura Dmitry https://github.com/ovr <[email protected]>
4
 */
5
6
7
namespace PHPSA;
8
9
use Symfony\Component\Config\Loader\FileLoader;
10
use Symfony\Component\Yaml\Yaml;
11
12
class ConfigurationLoader extends FileLoader
13
{
14
    public function load($resource, $type = null)
15
    {
16
        try {
17
            $config = $this->locator->locate($resource);
0 ignored issues
show
Unused Code introduced by
$config is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
18
        } catch (\InvalidArgumentException $e) {
19
            return [];
20
        }
21
22
        return Yaml::parse(file_get_contents($resource));
23
    }
24
25
    public function supports($resource, $type = null)
26
    {
27
        return is_string($resource) && 'yml' === pathinfo($resource, PATHINFO_EXTENSION);
28
    }
29
}
30