| 1 | <?php |
||
| 17 | class TooSlowRecvException extends RecvDataException |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * Speed at the moment of exception in bytes per second |
||
| 21 | * |
||
| 22 | * @var double |
||
| 23 | */ |
||
| 24 | private $speed; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Duration of low speed in seconds |
||
| 28 | * |
||
| 29 | * @var int |
||
| 30 | */ |
||
| 31 | private $duration; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * {@inheritDoc} |
||
| 35 | */ |
||
| 36 | 1 | public function __construct( |
|
| 48 | |||
| 49 | /** |
||
| 50 | * tooSlowDataReceiving |
||
| 51 | * |
||
| 52 | * @param SocketInterface $socket Socket |
||
| 53 | * @param double $speed Speed at the moment of exception in bytes per second |
||
| 54 | * @param int $duration Duration of low speed in seconds |
||
| 55 | * |
||
| 56 | * @return TooSlowRecvException |
||
| 57 | */ |
||
| 58 | 1 | public static function tooSlowDataReceiving(SocketInterface $socket, $speed, $duration) |
|
| 67 | |||
| 68 | /** |
||
| 69 | * Return speed at the moment of exception in bytes per second |
||
| 70 | * |
||
| 71 | * @return float |
||
| 72 | */ |
||
| 73 | public function getSpeed() |
||
| 77 | |||
| 78 | /** |
||
| 79 | * Return duration of low speed in seconds |
||
| 80 | * |
||
| 81 | * @return int |
||
| 82 | */ |
||
| 83 | public function getDuration() |
||
| 87 | } |
||
| 88 |