setConfigurationFactory()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Magium\Configuration\Console\Command;
4
5
use Magium\Configuration\MagiumConfigurationFactory;
6
use Magium\Configuration\MagiumConfigurationFactoryInterface;
7
8
trait ConfigurationFactoryTrait
9
{
10
11
    protected $factory;
12
13 14
    public function setConfigurationFactory(MagiumConfigurationFactoryInterface $factory)
14
    {
15 14
        $this->factory = $factory;
16 14
    }
17
18 14
    protected function getConfigurationFactory()
19
    {
20 14
        if (!$this->factory instanceof MagiumConfigurationFactoryInterface) {
21
            $this->factory = new MagiumConfigurationFactory();
22
        }
23 14
        return $this->factory;
24
    }
25
}
26