Passed
Push — master ( b8091d...543f5f )
by Brendan
55s queued 11s
created

UndefinedCommandException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 71.43%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 26
ccs 5
cts 7
cp 0.7143
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getCommand() 0 4 1
1
<?php
2
3
/**
4
 * This file is part of graze/telnet-client.
5
 *
6
 * Copyright (c) 2016 Nature Delivered Ltd. <https://www.graze.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * @license https://github.com/graze/telnet-client/blob/master/LICENSE
12
 * @link https://github.com/graze/telnet-client
13
 */
14
15
namespace Graze\TelnetClient\Exception;
16
17
use Exception;
18
use OutOfBoundsException;
19
20
class UndefinedCommandException extends OutOfBoundsException implements TelnetExceptionInterface
21
{
22
    /**
23
     * @var string
24
     */
25
    protected $command;
26
27
    /**
28
     * @param string $command
29
     * @param Exception $previous
30
     */
31 1
    public function __construct($command, Exception $previous = null)
32
    {
33 1
        $this->command = $command;
34 1
        $message = sprintf('unable to interpret as command [%s]', $command);
35 1
        parent::__construct($message, 0, $previous);
36 1
    }
37
38
    /**
39
     * @return string
40
     */
41
    public function getCommand()
42
    {
43
        return $this->command;
44
    }
45
}
46