1 | <?php |
||
18 | abstract class AbstractIo implements IoInterface |
||
19 | { |
||
20 | /** |
||
21 | * Socket buffer size |
||
22 | */ |
||
23 | const SOCKET_BUFFER_SIZE = 8192; |
||
24 | |||
25 | /** |
||
26 | * Amount of attempts to set data |
||
27 | */ |
||
28 | const IO_ATTEMPTS = 10; |
||
29 | |||
30 | /** |
||
31 | * Socket |
||
32 | * |
||
33 | * @var SocketInterface |
||
34 | */ |
||
35 | protected $socket; |
||
36 | |||
37 | /** |
||
38 | * AbstractIo constructor. |
||
39 | * |
||
40 | * @param SocketInterface $socket Socket object |
||
41 | */ |
||
42 | 159 | public function __construct(SocketInterface $socket) |
|
46 | |||
47 | /** |
||
48 | * Throw network operation exception |
||
49 | * |
||
50 | * @param bool $condition Condition, which must evaluates to true for throwing exception |
||
51 | * @param string $message Exception message |
||
52 | * |
||
53 | * @return void |
||
54 | * @throws NetworkSocketException |
||
55 | */ |
||
56 | 38 | protected function throwNetworkSocketExceptionIf($condition, $message) |
|
62 | } |
||
63 |