ConfigurationAssembler   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 34
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setConfiguration() 0 4 1
A execute() 0 15 2
1
<?php
2
/**
3
 * @author stev leibelt <[email protected]>
4
 * @since 2015-05-31 
5
 */
6
7
namespace Net\Bazzline\Component\Locator\Process\Transformer\Assembler;
8
9
use Net\Bazzline\Component\Locator\Configuration\Configuration;
10
use Net\Bazzline\Component\ProcessPipe\ExecutableException;
11
use Net\Bazzline\Component\ProcessPipe\ExecutableInterface;
12
13
class ConfigurationAssembler implements ExecutableInterface
14
{
15
    /** @var Configuration */
16
    private $configuration;
17
18
    /**
19
     * @param Configuration $configuration
20
     */
21
    public function setConfiguration(Configuration $configuration)
22
    {
23
        $this->configuration = $configuration;
24
    }
25
26
    /**
27
     * @param array $input
28
     * @return array
29
     * @throws ExecutableException
30
     */
31
    public function execute($input = null)
32
    {
33
        if (!is_array($input)) {
34
            throw new ExecutableException(
35
                'input must be an array'
36
            );
37
        }
38
39
        /** @var \Net\Bazzline\Component\Locator\Configuration\Assembler\AssemblerInterface $assembler */
40
        $assembler              = new $input['assembler'];
41
        $configuration          = $this->configuration;
42
        $input['configuration'] = $assembler->assemble($input, $configuration);
43
44
        return $input;
45
    }
46
}