mitrobill/system/autoload/PEAR2/Net/RouterOS/UnexpectedValueException.php

100 lines
2.5 KiB
PHP
Raw Normal View History

2017-03-11 02:51:06 +07:00
<?php
/**
* RouterOS API client implementation.
2023-10-05 16:55:44 +07:00
*
2017-03-11 02:51:06 +07:00
* 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.
2023-10-05 16:55:44 +07:00
*
2017-03-11 02:51:06 +07:00
* PHP version 5
2023-10-05 16:55:44 +07:00
*
2017-03-11 02:51:06 +07:00
* @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
2023-10-05 16:55:44 +07:00
* @version 1.0.0b6
2017-03-11 02:51:06 +07:00
* @link http://pear2.php.net/PEAR2_Net_RouterOS
*/
/**
* The namespace declaration.
*/
namespace PEAR2\Net\RouterOS;
2023-10-05 16:55:44 +07:00
/**
* The base for this exception.
*/
2017-03-11 02:51:06 +07:00
use UnexpectedValueException as U;
2023-10-05 16:55:44 +07:00
/**
* Used in $previous.
*/
use Exception as E;
2017-03-11 02:51:06 +07:00
/**
* Exception thrown when encountering an invalid value in a function argument.
2023-10-05 16:55:44 +07:00
*
2017-03-11 02:51:06 +07:00
* @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 UnexpectedValueException extends U implements Exception
{
const CODE_CALLBACK_INVALID = 10502;
const CODE_ACTION_UNKNOWN = 30100;
const CODE_RESPONSE_TYPE_UNKNOWN = 50100;
/**
2023-10-05 16:55:44 +07:00
* The unexpected value.
*
* @var mixed
2017-03-11 02:51:06 +07:00
*/
private $_value;
/**
* Creates a new UnexpectedValueException.
2023-10-05 16:55:44 +07:00
*
* @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
2017-03-11 02:51:06 +07:00
* chaining.
2023-10-05 16:55:44 +07:00
* @param mixed $value The unexpected value.
2017-03-11 02:51:06 +07:00
*/
public function __construct(
$message,
$code = 0,
2023-10-05 16:55:44 +07:00
E $previous = null,
2017-03-11 02:51:06 +07:00
$value = null
) {
parent::__construct($message, $code, $previous);
$this->_value = $value;
}
/**
* Gets the unexpected value.
2023-10-05 16:55:44 +07:00
*
2017-03-11 02:51:06 +07:00
* @return mixed The unexpected value.
*/
public function getValue()
{
return $this->_value;
}
// @codeCoverageIgnoreStart
// String representation is not reliable in testing
/**
* Returns a string representation of the exception.
2023-10-05 16:55:44 +07:00
*
2017-03-11 02:51:06 +07:00
* @return string The exception as a string.
*/
public function __toString()
{
return parent::__toString() . "\nValue:{$this->_value}";
}
// @codeCoverageIgnoreEnd
}