PHPStanAnalyseCommandBuilder   A
last analyzed

Complexity

Total Complexity 12

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 12
eloc 23
dl 0
loc 36
ccs 23
cts 23
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
F build() 0 34 12
1
<?php
2
3
/**
4
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
5
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
6
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
7
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
10
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
12
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
13
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
14
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15
 *
16
 * This software consists of voluntary contributions made by many individuals
17
 * and is licensed under the LGPL. For more information please see
18
 * <http://phing.info>.
19
 */
20
21
declare(strict_types=1);
22
23
namespace Phing\Task\Ext\Analyzer\Phpstan\CommandBuilder;
24
25
use Phing\Task\Ext\Analyzer\Phpstan\PHPStanTask;
26
27
class PHPStanAnalyseCommandBuilder extends PHPStanCommandBuilder
28
{
29 6
    public function build(PHPStanTask $task): void
30
    {
31 6
        parent::build($task);
32
33 6
        $cmd = $task->getCommandline();
34
35 6
        if (!empty($task->getConfiguration())) {
36 2
            $cmd->createArgument()->setValue('--configuration=' . $task->getConfiguration());
37
        }
38 6
        if (!empty($task->getLevel())) {
39 2
            $cmd->createArgument()->setValue('--level=' . $task->getLevel());
40
        }
41 6
        if ($task->isNoProgress()) {
42 2
            $cmd->createArgument()->setValue('--no-progress');
43
        }
44 6
        if ($task->isDebug()) {
45 2
            $cmd->createArgument()->setValue('--debug');
46
        }
47 6
        if (!empty($task->getAutoloadFile())) {
48 2
            $cmd->createArgument()->setValue('--autoload-file=' . $task->getAutoloadFile());
49
        }
50 6
        if (!empty($task->getErrorFormat())) {
51 2
            $cmd->createArgument()->setValue('--error-format=' . $task->getErrorFormat());
52
        }
53 6
        if (!empty($task->getMemoryLimit())) {
54 2
            $cmd->createArgument()->setValue('--memory-limit=' . $task->getMemoryLimit());
55
        }
56 6
        if (!empty($task->getPaths())) {
57 2
            $cmd->createArgument()->setValue($task->getPaths());
58
        }
59 6
        if (count($task->getFileSets()) > 0) {
60 1
            foreach ($task->getFileSets() as $fs) {
61 1
                foreach ($fs as $file) {
62 1
                    $cmd->createArgument()->setValue($file);
63
                }
64
            }
65
        }
66
    }
67
}
68