| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace malkusch\lock\exception; |
| 6 |
|
| 7 |
/** |
| 8 |
* Timeout exception. |
| 9 |
* |
| 10 |
* A timeout has been exceeded exception. Should only be used in contexts where |
| 11 |
* the lock is being acquired. |
| 12 |
* |
| 13 |
* @author Markus Malkusch <markus@malkusch.de> |
| 14 |
* @link bitcoin:1P5FAZ4QhXCuwYPnLZdk3PJsqePbu1UDDA Donations |
| 15 |
* @license WTFPL |
| 16 |
*/ |
| 17 |
class TimeoutException extends LockAcquireException |
| 18 |
{ |
| 19 |
/** |
| 20 |
* Creates a new instance of the TimeoutException class. |
| 21 |
* |
| 22 |
* @param int $timeout The timeout in seconds. |
| 23 |
* @return self A timeout has been exceeded exception. |
| 24 |
*/ |
| 25 |
public static function create(int $timeout): self |
| 26 |
{ |
| 27 |
return new self(\sprintf('Timeout of %d seconds exceeded.', $timeout)); |
| 28 |
} |
| 29 |
} |
| 30 |
|