PEAR2_Net_RouterOS › PEAR2_Net_RouterOS-1.0.0b5/src/PEAR2/Net/RouterOS/LengthException.php
- PEAR2_Net_RouterOS-1.0.0b5/
- data/
- pear2.php.net/
- PEAR2_Console_CommandLine/
- roscon.xml
- pear2.php.net/
- docs/
- examples/
- scripts/
- src/
- PEAR2/
- Autoload.php
- Cache/
- Console/
- Color/
- Color.php
- CommandLine/
- Action/
- Action.php
- Argument.php
- Command.php
- CustomMessageProvider.php
- Element.php
- Exception.php
- MessageProvider/
- MessageProvider.php
- Option.php
- Outputter/
- Outputter.php
- Renderer/
- Renderer.php
- Result.php
- XmlParser.php
- CommandLine.php
- Net/
- RouterOS/
- Transmitter/
- PEAR2/
- tests/
- Client/
- Safe/
- Safe.php
- Unsafe/
- Unsafe.php
- ConnectionTest.php
- Extra/
- HandlingTest.php
- RouterOS_SETTINGS.rsc
- Util/
- Safe/
- Safe.php
- Unsafe/
- Unsafe.php
- bootstrap.php
- phpunit.xml
- Client/
- data/
- package.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
/**
* RouterOS API client implementation.
*
* RouterOS is the flag product of the company MikroTik and is a powerful router software. One of its many abilities is to allow control over it via an API. This package provides a client for that API, in turn allowing you to use PHP to control RouterOS hosts.
*
* PHP version 5
*
* @category Net
* @package PEAR2_Net_RouterOS
* @author Vasil Rangelov <boen.robot@gmail.com>
* @copyright 2011 Vasil Rangelov
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version 1.0.0b5
* @link http://pear2.php.net/PEAR2_Net_RouterOS
*/
/**
* The namespace declaration.
*/
namespace PEAR2\Net\RouterOS;
/**
* Base of this class.
*/
use LengthException as L;
/**
* Exception thrown when there is a problem with a word's length.
*
* @category Net
* @package PEAR2_Net_RouterOS
* @author Vasil Rangelov <boen.robot@gmail.com>
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @link http://pear2.php.net/PEAR2_Net_RouterOS
*/
class LengthException extends L implements Exception
{
const CODE_UNSUPPORTED = 1200;
const CODE_INVALID = 1300;
const CODE_BEYOND_SHEME = 1301;
/**
*
* @var mixed The problematic length.
*/
private $_length;
/**
* Creates a new LengthException.
*
* @param string $message The Exception message to throw.
* @param int $code The Exception code.
* @param \Exception $previous The previous exception used for the exception
* chaining.
* @param number $length The length.
*/
public function __construct(
$message,
$code = 0,
$previous = null,
$length = null
) {
parent::__construct($message, $code, $previous);
$this->_length = $length;
}
/**
* Gets the length.
*
* @return number The length.
*/
public function getLength()
{
return $this->_length;
}
// @codeCoverageIgnoreStart
// String representation is not reliable in testing
/**
* Returns a string representation of the exception.
*
* @return string The exception as a string.
*/
public function __toString()
{
return parent::__toString() . "\nLength:{$this->_length}";
}
// @codeCoverageIgnoreEnd
}
EOF