BuilderFactory::get()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 19
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 19
ccs 0
cts 14
cp 0
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 10
nc 2
nop 4
crap 6
1
<?php
2
3
/*
4
 * This file is part of the Conveyor package.
5
 *
6
 * (c) Jeroen Fiege <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Webcreate\Conveyor\Factory;
13
14
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
15
use Webcreate\Conveyor\Builder\Builder;
16
use Webcreate\Conveyor\Config\YamlConfig;
17
use Webcreate\Conveyor\IO\IOInterface;
18
19
class BuilderFactory
20
{
21
    /**
22
     * @param  YamlConfig               $config
23
     * @param  IOInterface              $io
24
     * @param  EventDispatcherInterface $dispatcher
25
     * @param  TaskFactory              $taskFactory
26
     * @return Builder
27
     */
28
    public static function get(YamlConfig $config, IOInterface $io, EventDispatcherInterface $dispatcher, TaskFactory $taskFactory)
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $io. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
29
    {
30
        $_config = $config->getConfig();
31
32
        $buildDir = $_config['build']['dir'];
33
34
        $builderTasks = array(
35
            $taskFactory->get('export'),
36
        );
37
38
        foreach ($_config['build']['tasks'] as $taskConfig) {
39
            $task = $taskFactory->get($taskConfig['type'], $taskConfig);
40
            $builderTasks[] = $task;
41
        }
42
43
        $builder = new Builder($buildDir, $builderTasks, $io, $dispatcher);
44
45
        return $builder;
46
    }
47
}
48