CommandSet   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 18
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A assertValid() 0 10 3
1
<?php
2
3
namespace Equip\Console\Command;
4
5
use Equip\Console\Exception\CommandException;
6
use Equip\Structure\Set;
7
use Symfony\Component\Console\Command\Command;
8
9
class CommandSet extends Set
10
{
11
    /**
12
     * {@inheritdoc}
13
     *
14
     * @throws CommandException If $commands does not extend the Command class
15
     */
16
    protected function assertValid(array $commands)
17
    {
18
        parent::assertValid($commands);
19
20
        foreach ($commands as $command) {
21
            if (!is_subclass_of($command, Command::class)) {
0 ignored issues
show
Bug introduced by
Due to PHP Bug #53727, is_subclass_of might return inconsistent results on some PHP versions if \Symfony\Component\Console\Command\Command::class can be an interface. If so, you could instead use ReflectionClass::implementsInterface.
Loading history...
22
                throw CommandException::invalidCommand($command);
23
            }
24
        }
25
    }
26
}
27