BuilderFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 29
ccs 0
cts 14
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 19 2
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