ConfigurationAssembler::execute()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 9.7666
c 0
b 0
f 0
cc 2
nc 2
nop 1
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
}