Passed
Push — master ( acb91e...fcfd07 )
by Gabriel
14:32
created

HasConfigurationTrait::initConfiguration()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace Nip\Dispatcher\Configuration;
5
6
/**
7
 * Trait HasConfigurationTrait
8
 */
9
trait HasConfigurationTrait
10
{
11
    /**
12
     * @var null|Configuration
13
     */
14
    protected $configuration = null;
15
16
    /**
17
     * @return Configuration
18
     */
19
    public function getConfiguration()
20
    {
21
        if ($this->configuration === null) {
22
            $this->initConfiguration();
23
        }
24
        return $this->configuration;
25
    }
26
27
    /**
28
     * @param Configuration $configuration
29
     */
30
    public function setConfiguration(Configuration $configuration): void
31
    {
32
        $this->configuration = $configuration;
33
    }
34
35
36
    public function initConfiguration()
37
    {
38
        $this->configuration = (new Configuration());
39
    }
40
}
41