ApplyTask::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
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