Passed
Push — master ( 71afca...9e5fe0 )
by Tom
04:18
created

Definitions   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 13
c 1
b 0
f 1
dl 0
loc 69
ccs 15
cts 15
cp 1
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getServices() 0 3 1
A __construct() 0 11 1
A parseDefinitionsServices() 0 3 1
A getCaches() 0 3 1
A parseDefinitionsCaches() 0 3 1
1
<?php
2
3
/* this file is part of pipelines */
4
5
namespace Ktomk\Pipelines\File;
6
7
use Ktomk\Pipelines\File\Definitions\Caches;
8
use Ktomk\Pipelines\File\Definitions\Services;
9
use Ktomk\Pipelines\Lib;
10
11
/**
12
 * Definitions node in pipelines file
13
 *
14
 * @package Ktomk\Pipelines\File
15
 */
16
class Definitions
17
{
18
    /**
19
     * @var array
20
     */
21
    private $array;
22
23
    /**
24
     * @var Definitions\Caches
25
     */
26
    private $caches;
27
28
    /**
29
     * @var Definitions\Services
30
     */
31
    private $services;
32
33
    /**
34
     * Definitions constructor.
35
     *
36
     * @param array $array
37
     */
38 1
    public function __construct(array $array)
39
    {
40 1
        Lib::v($array['caches'], array());
41
42 1
        $this->caches = $this->parseDefinitionsCaches($array['caches']);
43
44 1
        Lib::v($array['services'], array());
45
46 1
        $this->services = $this->parseDefinitionsServices($array['services']);
47
48 1
        $this->array = $array;
49 1
    }
50
51
    /**
52
     * @return Caches
53
     */
54 1
    public function getCaches()
55
    {
56 1
        return $this->caches;
57
    }
58
59
    /**
60
     * @return Services
61
     */
62 1
    public function getServices()
63
    {
64 1
        return $this->services;
65
    }
66
67
    /**
68
     * @param array $array
69
     *
70
     * @return Caches
71
     */
72 1
    private function parseDefinitionsCaches(array $array)
73
    {
74 1
        return new Caches($array);
75
    }
76
77
    /**
78
     * @param array $array
79
     *
80
     * @return Services
81
     */
82 1
    private function parseDefinitionsServices(array $array)
83
    {
84 1
        return new Services($array);
85
    }
86
}
87