1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* ~~summary~~ |
5
|
|
|
* |
6
|
|
|
* ~~description~~ |
7
|
|
|
* |
8
|
|
|
* PHP version 5 |
9
|
|
|
* |
10
|
|
|
* @category Net |
11
|
|
|
* @package PEAR2_Net_RouterOS |
12
|
|
|
* @author Vasil Rangelov <[email protected]> |
13
|
|
|
* @copyright 2011 Vasil Rangelov |
14
|
|
|
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 |
15
|
|
|
* @version GIT: $Id$ |
16
|
|
|
* @link http://pear2.php.net/PEAR2_Net_RouterOS |
17
|
|
|
*/ |
18
|
|
|
/** |
19
|
|
|
* The namespace declaration. |
20
|
|
|
*/ |
21
|
|
|
namespace PEAR2\Net\RouterOS; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Base of this class. |
25
|
|
|
*/ |
26
|
|
|
use Exception as E; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Exception thrown when encountering something not supported by RouterOS or |
30
|
|
|
* this package. |
31
|
|
|
* |
32
|
|
|
* @category Net |
33
|
|
|
* @package PEAR2_Net_RouterOS |
34
|
|
|
* @author Vasil Rangelov <[email protected]> |
35
|
|
|
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 |
36
|
|
|
* @link http://pear2.php.net/PEAR2_Net_RouterOS |
37
|
|
|
*/ |
38
|
|
|
class NotSupportedException extends E implements Exception |
39
|
|
|
{ |
40
|
|
|
|
41
|
|
|
const CODE_CONTROL_BYTE = 1601; |
42
|
|
|
|
43
|
|
|
const CODE_MENU_MISMATCH = 60000; |
44
|
|
|
|
45
|
|
|
const CODE_ARG_PROHIBITED = 60001; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* The unsupported value. |
49
|
|
|
* |
50
|
|
|
* @var mixed |
51
|
|
|
*/ |
52
|
|
|
private $_value; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Creates a new NotSupportedException. |
56
|
|
|
* |
57
|
|
|
* @param string $message The Exception message to throw. |
58
|
|
|
* @param int $code The Exception code. |
59
|
|
|
* @param E|null $previous The previous exception used for the exception |
60
|
|
|
* chaining. |
61
|
|
|
* @param mixed $value The unsupported value. |
62
|
|
|
*/ |
63
|
|
|
public function __construct( |
64
|
|
|
$message, |
65
|
|
|
$code = 0, |
66
|
|
|
E $previous = null, |
67
|
|
|
$value = null |
68
|
|
|
) { |
69
|
|
|
parent::__construct($message, $code, $previous); |
70
|
|
|
$this->_value = $value; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Gets the unsupported value. |
75
|
|
|
* |
76
|
|
|
* @return mixed The unsupported value. |
77
|
|
|
*/ |
78
|
|
|
public function getValue() |
79
|
|
|
{ |
80
|
|
|
return $this->_value; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
// @codeCoverageIgnoreStart |
84
|
|
|
// String representation is not reliable in testing |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* Returns a string representation of the exception. |
88
|
|
|
* |
89
|
|
|
* @return string The exception as a string. |
90
|
|
|
*/ |
91
|
|
|
public function __toString() |
92
|
|
|
{ |
93
|
|
|
return parent::__toString() . "\nValue:{$this->_value}"; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
// @codeCoverageIgnoreEnd |
97
|
|
|
} |
98
|
|
|
|