Load   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 70%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 32
ccs 7
cts 10
cp 0.7
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A fromFile() 0 4 1
A __construct() 0 8 2
A getScripts() 0 4 1
1
<?php
2
3
namespace Hairmare\Dodat;
4
5
use Symfony\Component\Yaml\Yaml;
6
7
class Load
8
{
9
    /**
10
     * @var array
11
     */
12
    private $data;
13
14
    public static function fromFile($file)
15
    {
16
        return new Load(file_get_contents($file));
17
    }
18
19
    /**
20
     * @param string $json
21
     */
22 2
    public function __construct($json)
23
    {
24 2
        $data = Yaml::parse($json);
25 2
        if (!is_array($data)) {
26
            throw new \RuntimeException('Found non array data in .travis.yml');
27
        }
28 2
        $this->data = $data;
29 2
    }
30
31
    /**
32
     * @return string[]
33
     */
34 2
    public function getScripts()
35
    {
36 2
        return $this->data['script'];
37
    }
38
}
39