forked from kevinowino869/mitrobill
.github
admin
install
pages_template
qrcode
system
autoload
PEAR2
Cache
Console
Net
RouterOS
Client.php
Communicator.php
DataFlowException.php
Exception.php
InvalidArgumentException.php
LengthException.php
Message.php
NotSupportedException.php
ParserException.php
Query.php
Registry.php
Request.php
Response.php
ResponseCollection.php
RouterErrorException.php
Script.php
SocketException.php
UnexpectedValueException.php
Util.php
Transmitter
Autoload.php
Admin.php
App.php
Balance.php
File.php
Hookers.php
Http.php
Lang.php
Log.php
Message.php
Mikrotik.php
Package.php
Paginator.php
Password.php
Radius.php
Timezone.php
User.php
Validator.php
index.html
cache
controllers
lan
paymentgateway
plugin
uploads
vendor
.htaccess
api.php
boot.php
composer.json
composer.lock
cron.php
cron_reminder.php
index.html
orm.php
updates.json
ui
.gitignore
.htaccess_firewall
CHANGELOG.md
LICENSE
README.md
composer.json
config.sample.php
favicon.ico
index.php
init.php
update.php
version.json
101 lines
2.4 KiB
PHP
101 lines
2.4 KiB
PHP
<?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.0b6
|
|
* @link http://pear2.php.net/PEAR2_Net_RouterOS
|
|
*/
|
|
/**
|
|
* The namespace declaration.
|
|
*/
|
|
namespace PEAR2\Net\RouterOS;
|
|
|
|
/**
|
|
* Base of this class.
|
|
*/
|
|
use LengthException as L;
|
|
|
|
/**
|
|
* Used in $previous
|
|
*/
|
|
use Exception as E;
|
|
|
|
/**
|
|
* 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;
|
|
|
|
/**
|
|
* The problematic length.
|
|
*
|
|
* @var int|double|null
|
|
*/
|
|
private $_length;
|
|
|
|
/**
|
|
* Creates a new LengthException.
|
|
*
|
|
* @param string $message The Exception message to throw.
|
|
* @param int $code The Exception code.
|
|
* @param E|null $previous The previous exception used for the
|
|
* exception chaining.
|
|
* @param int|double|null $length The length.
|
|
*/
|
|
public function __construct(
|
|
$message,
|
|
$code = 0,
|
|
E $previous = null,
|
|
$length = null
|
|
) {
|
|
parent::__construct($message, $code, $previous);
|
|
$this->_length = $length;
|
|
}
|
|
|
|
/**
|
|
* Gets the length.
|
|
*
|
|
* @return int|double|null 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
|
|
}
|