PHP   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A parse() 0 9 2
1
<?php
2
namespace Fyuze\Config\Parsers;
3
4
use SplFileInfo;
5
use RuntimeException;
6
7
class PHP
8
{
9
    /**
10
     * @var array
11
     */
12
    public static $extensions = ['php'];
13
14
    /**
15
     * @param SplFileInfo $file
16
     * @return array
17
     * @throws RuntimeException
18
     */
19 14
    public function parse(SplFileInfo $file)
20
    {
21 14
        $contents = require $file->getRealPath();
22
23 14
        if (!is_array($contents)) {
24 1
            throw new RuntimeException(sprintf('The configuration file %s did not return an array', $file->getBasename('.php')));
25
        }
26
27 13
        return $contents;
28
    }
29
}
30