Completed
Push — master ( 5927eb...1e13db )
by
unknown
04:04
created

FileLoader::load()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 8
ccs 4
cts 4
cp 1
crap 2
rs 9.4285
1
<?php
2
3
namespace League\JsonGuard\Loaders;
4
5
use League\JsonGuard;
6
use League\JsonGuard\Exceptions\SchemaLoadingException;
7
use League\JsonGuard\Loader;
8
9
class FileLoader implements Loader
10
{
11
    /**
12
     * {@inheritdoc}
13
     */
14 12
    public function load($path)
15
    {
16 12
        if (!file_exists($path)) {
17 2
            throw SchemaLoadingException::notFound($path);
18
        }
19
20 10
        return JsonGuard\json_decode(file_get_contents($path));
21
    }
22
}
23