UndefinedCommandException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 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