| 1 |
<?php |
| 2 |
|
| 3 |
namespace React\Promise\Timer; |
| 4 |
|
| 5 |
use RuntimeException; |
| 6 |
|
| 7 |
class TimeoutException extends RuntimeException |
| 8 |
{ |
| 9 |
/** @var float */ |
| 10 |
private $timeout; |
| 11 |
|
| 12 |
/** |
| 13 |
* @param float $timeout |
| 14 |
* @param string|null $message |
| 15 |
* @param int|null $code |
| 16 |
* @param null|\Exception|\Throwable $previous |
| 17 |
*/ |
| 18 |
public function __construct($timeout, $message = '', $code = 0, $previous = null) |
| 19 |
{ |
| 20 |
// Preserve compatibility with our former nullable signature, but avoid invalid arguments for the parent constructor: |
| 21 |
parent::__construct((string) $message, (int) $code, $previous); |
| 22 |
|
| 23 |
$this->timeout = (float) $timeout; |
| 24 |
} |
| 25 |
|
| 26 |
/** |
| 27 |
* Get the timeout value in seconds. |
| 28 |
* |
| 29 |
* @return float |
| 30 |
*/ |
| 31 |
public function getTimeout() |
| 32 |
{ |
| 33 |
return $this->timeout; |
| 34 |
} |
| 35 |
} |