1 | <?php |
||
4 | class Stream { |
||
5 | |||
6 | /** |
||
7 | * @var resource |
||
8 | */ |
||
9 | protected $_stream; |
||
10 | |||
11 | /** |
||
12 | * @var array |
||
13 | */ |
||
14 | protected $_options = [ |
||
15 | 'host' => null, |
||
16 | 'port' => 9042, |
||
17 | 'username' => null, |
||
18 | 'password' => null, |
||
19 | 'timeout' => 30, |
||
20 | 'connectTimeout'=>5, |
||
21 | 'persistent'=> false, |
||
22 | ]; |
||
23 | |||
24 | /** |
||
25 | * @param array $options |
||
26 | */ |
||
27 | public function __construct(array $options) { |
||
32 | |||
33 | /** |
||
34 | * |
||
35 | * @throws StreamException |
||
36 | * @return resource |
||
37 | */ |
||
38 | protected function _connect() { |
||
51 | |||
52 | /** |
||
53 | * @return array |
||
54 | */ |
||
55 | public function getOptions() { |
||
58 | |||
59 | /** |
||
60 | * @param $length |
||
61 | * @throws StreamException |
||
62 | * @return string |
||
63 | */ |
||
64 | public function read($length) { |
||
85 | |||
86 | /** |
||
87 | * @param $length |
||
88 | * @throws StreamException |
||
89 | * @return string |
||
90 | */ |
||
91 | public function readOnce($length){ |
||
105 | |||
106 | /** |
||
107 | * |
||
108 | * @param string $binary |
||
109 | * @throws StreamException |
||
110 | */ |
||
111 | public function write($binary){ |
||
128 | |||
129 | public function close(){ |
||
132 | } |
||
133 |