ExtendableConfigurationContainer   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 6
Bugs 3 Features 0
Metric Value
wmc 5
c 6
b 3
f 0
lcom 1
cbo 2
dl 0
loc 34
ccs 11
cts 11
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A loadParent() 0 6 3
A getValueOrDefault() 0 6 1
A getValueOrFail() 0 6 1
1
<?php
2
3
namespace Onigoetz\Deployer\Configuration\Containers;
4
5
abstract class ExtendableConfigurationContainer extends InheritingConfigurationContainer
6
{
7
    /**
8
     * Loads the parent instance specified in the 'extends' key
9
     */
10 117
    protected function loadParent()
11
    {
12 117
        if (!$this->parent && array_key_exists('extends', $this->data)) {
13 21
            $this->parent = $this->manager->get($this->getContainerType(), $this->data['extends']);
14 12
        }
15 114
    }
16
17
    /**
18
     * {@inheritdoc}
19
     * @param string $key
20
     */
21 117
    protected function getValueOrFail($key, $errorMessage)
22
    {
23 117
        $this->loadParent();
24
25 114
        return parent::getValueOrFail($key, $errorMessage);
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     * @param string $key
31
     */
32 69
    protected function getValueOrDefault($key, $default)
33
    {
34 69
        $this->loadParent();
35
36 69
        return parent::getValueOrDefault($key, $default);
37
    }
38
}
39