Completed
Push — master ( 9c1f83...0c1135 )
by Paulo Rodrigues
10:00
created

JsonManifestLoader::parse()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2.032

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
ccs 4
cts 5
cp 0.8
rs 9.4285
cc 2
eloc 5
nc 2
nop 1
crap 2.032
1
<?php
2
3
namespace Rj\FrontendBundle\Manifest\Loader;
4
5
class JsonManifestLoader extends AbstractManifestLoader
6
{
7
    /**
8
     * {@inheritdoc}
9
     */
10 14
    protected function parse($path)
11
    {
12 14
        $entries = json_decode(file_get_contents($path), true);
13
14 14
        if (json_last_error() !== JSON_ERROR_NONE) {
15
            throw new \Exception("Failed to parse json manifest file ($path): ".json_last_error_msg());
0 ignored issues
show
Coding Style Best Practice introduced by
As per coding-style, please use concatenation or sprintf for the variable $path instead of interpolation.

It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings.

// Instead of
$x = "foo $bar $baz";

// Better use either
$x = "foo " . $bar . " " . $baz;
$x = sprintf("foo %s %s", $bar, $baz);
Loading history...
16
        }
17
18 14
        return $entries;
19
    }
20
}
21