Completed
Push — master ( cda5b1...d40a3f )
by Ross
02:15
created

CanNotDetermineCommandNameException::getCommand()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 4
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace League\Tactician\Exception;
4
5
/**
6
 * Thrown when a CommandNameExtractor cannot determine the command's name
7
 */
8 View Code Duplication
class CanNotDetermineCommandNameException extends \RuntimeException implements Exception
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
9
{
10
    /**
11
     * @var mixed
12
     */
13
    private $command;
14
15
    /**
16
     * @param mixed $command
17
     *
18
     * @return static
19
     */
20 11
    public static function forCommand($command)
21
    {
22 11
        $type =  is_object($command) ? get_class($command) : gettype($command);
23
24 11
        $exception = new static('Could not determine command name of ' . $type);
25 11
        $exception->command = $command;
26
27 11
        return $exception;
28
    }
29
30
    /**
31
     * Returns the command that could not be invoked
32
     *
33
     * @return mixed
34
     */
35 10
    public function getCommand()
36
    {
37 10
        return $this->command;
38
    }
39
}
40