ApplyTask   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 5

Importance

Changes 0
Metric Value
wmc 3
cbo 5
dl 0
loc 32
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 7 1
A run() 0 13 2
1
<?php
2
3
/**
4
 * This file is part of Bldr.io
5
 *
6
 * (c) Aaron Scherer <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE
10
 */
11
12
namespace Bldr\Block\Execute\Task;
13
14
use Bldr\Block\Core\Task\Traits\FinderAwareTrait;
15
use Symfony\Component\Console\Output\OutputInterface;
16
17
/**
18
 * @author Aaron Scherer <[email protected]>
19
 */
20
class ApplyTask extends ExecuteTask
21
{
22
    use FinderAwareTrait;
23
24
    /**
25
     * {@inheritDoc}
26
     */
27
    public function configure()
28
    {
29
        parent::configure();
30
        $this->setName('apply')
31
            ->addParameter('src', true, 'Source to run the apply on')
32
        ;
33
    }
34
35
    /**
36
     * {@inheritDoc}
37
     */
38
    public function run(OutputInterface $output)
39
    {
40
        $output->writeln(['', sprintf("    <info>[%s]</info> - <comment>Starting</comment>", $this->getName()), '']);
41
42
        $arguments = $this->getParameter('arguments');
43
        $files     = $this->getFiles($this->getParameter('src'));
0 ignored issues
show
Bug introduced by
It seems like $this->getParameter('src') targeting Bldr\Block\Core\Task\AbstractTask::getParameter() can also be of type string; however, Bldr\Block\Core\Task\Tra...rAwareTrait::getFiles() does only seem to accept array, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
44
        foreach ($files as $file) {
45
            $args   = $arguments;
46
            $args[] = $file->getRealPath();
47
            $this->setParameter('arguments', $args);
48
            parent::run($output);
49
        }
50
    }
51
}
52