Passed
Pull Request — master (#99)
by Evgeniy
05:38
created

FileJSON   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 10
ccs 6
cts 6
cp 1
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cekta\DI\Provider;
6
7
use InvalidArgumentException;
8
9
class FileJSON extends KeyValue
10
{
11 12
    public function __construct(string $path)
12
    {
13 12
        if (!file_exists($path)) {
14 3
            throw new InvalidArgumentException("invalid path: `$path`");
15
        }
16 12
        $content = file_get_contents($path);
17 12
        assert(is_string($content));
18 12
        parent::__construct(json_decode($content, true));
19 12
    }
20
}
21