CommandException::invalidCommand()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
rs 9.4285
cc 2
eloc 7
nc 2
nop 1
1
<?php
2
3
namespace Equip\Console\Exception;
4
5
use DomainException;
6
use Symfony\Component\Console\Command\Command;
7
8
class CommandException extends DomainException
9
{
10
    /**
11
     * @param string|object $spec
12
     *
13
     * @return static
14
     */
15
    public static function invalidCommand($spec)
16
    {
17
        if (is_object($spec)) {
18
            $spec = get_class($spec);
19
        }
20
21
        return new static(sprintf(
22
            'Command class `%s` must extend `%s`',
23
            $spec,
24
            Command::class
25
        ));
26
    }
27
}
28