2016-05-28 15:57:07 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Interop\Async\Loop;
|
|
|
|
|
|
|
|
/**
|
2016-09-21 18:05:59 +02:00
|
|
|
* MUST be thrown if any operation (except disable() and cancel()) is attempted with an invalid watcher identifier.
|
|
|
|
*
|
|
|
|
* An invalid watcher identifier is any identifier that is not yet emitted by the driver or cancelled by the user.
|
2016-05-28 15:57:07 +02:00
|
|
|
*/
|
2016-09-21 18:05:59 +02:00
|
|
|
class InvalidWatcherException extends \Exception
|
2016-05-28 15:57:07 +02:00
|
|
|
{
|
2016-11-06 18:38:20 +01:00
|
|
|
/** @var string */
|
|
|
|
private $watcherId;
|
2016-05-28 15:57:07 +02:00
|
|
|
|
2016-11-06 18:38:20 +01:00
|
|
|
/**
|
|
|
|
* @param string $watcherId The watcher identifier.
|
|
|
|
* @param string|null $message The exception message.
|
|
|
|
*/
|
|
|
|
public function __construct($watcherId, $message = null)
|
|
|
|
{
|
|
|
|
$this->watcherId = $watcherId;
|
|
|
|
|
|
|
|
if ($message === null) {
|
|
|
|
$message = "An invalid watcher idenfier has been used: '{$watcherId}'";
|
|
|
|
}
|
|
|
|
|
|
|
|
parent::__construct($message);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string The watcher identifier.
|
|
|
|
*/
|
|
|
|
public function getWatcherId()
|
|
|
|
{
|
|
|
|
return $this->watcherId;
|
|
|
|
}
|
2016-05-28 15:57:07 +02:00
|
|
|
}
|