@@ -50,7 +50,8 @@ discard block |
||
50 | 50 | /** |
51 | 51 | * Output some data |
52 | 52 | * @param string String to out |
53 | - * @return boolean Success |
|
53 | + * @param string $s |
|
54 | + * @return boolean|null Success |
|
54 | 55 | */ |
55 | 56 | public function out($s, $flush = true) { |
56 | 57 | } |
@@ -222,6 +223,7 @@ discard block |
||
222 | 223 | |
223 | 224 | /** |
224 | 225 | * Adds new callback called before the request finished |
226 | + * @param Closure $callback |
|
225 | 227 | * @return void |
226 | 228 | */ |
227 | 229 | public function registerShutdownFunction($callback) { |
@@ -6,6 +6,9 @@ discard block |
||
6 | 6 | public $name; |
7 | 7 | public $key; |
8 | 8 | |
9 | + /** |
|
10 | + * @param string $name |
|
11 | + */ |
|
9 | 12 | public function __construct($path, $segsize, $name, $create = false) { |
10 | 13 | $this->path = $path; |
11 | 14 | $this->segsize = $segsize; |
@@ -55,6 +58,9 @@ discard block |
||
55 | 58 | } while ($r); |
56 | 59 | } |
57 | 60 | |
61 | + /** |
|
62 | + * @param string $data |
|
63 | + */ |
|
58 | 64 | public function write($data, $offset) { |
59 | 65 | $segno = floor($offset / $this->segsize); |
60 | 66 | if (!isset($this->segments[$segno])) { |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | /** |
155 | 155 | * Starts the process |
156 | - * @return void |
|
156 | + * @return null|integer |
|
157 | 157 | */ |
158 | 158 | public function start($clearstack = true) { |
159 | 159 | $pid = pcntl_fork(); |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | /** |
206 | 206 | * Sends the signal to parent process |
207 | 207 | * @param integer Signal's number |
208 | - * @return void |
|
208 | + * @return boolean |
|
209 | 209 | */ |
210 | 210 | private function backsig($sig) { |
211 | 211 | return posix_kill(posix_getppid(), $sig); |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | /** |
215 | 215 | * Delays the process execution for the given number of seconds |
216 | 216 | * @param integer Sleep time in seconds |
217 | - * @return void |
|
217 | + * @return boolean |
|
218 | 218 | */ |
219 | 219 | public function sleep($s) { |
220 | 220 | static $interval = 0.2; |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | /** |
275 | 275 | * Terminates the process |
276 | 276 | * @param boolean Kill? |
277 | - * @return void |
|
277 | + * @return boolean |
|
278 | 278 | */ |
279 | 279 | public function stop($kill = false) { |
280 | 280 | $this->shutdown = true; |
@@ -328,6 +328,7 @@ discard block |
||
328 | 328 | |
329 | 329 | /** |
330 | 330 | * Waits until children is alive |
331 | + * @param boolean $check |
|
331 | 332 | * @return void |
332 | 333 | */ |
333 | 334 | protected function waitAll($check) { |
@@ -346,6 +347,7 @@ discard block |
||
346 | 347 | /** |
347 | 348 | * Sets a title of the current process |
348 | 349 | * @param string Title |
350 | + * @param string $title |
|
349 | 351 | * @return void |
350 | 352 | */ |
351 | 353 | protected function setproctitle($title) { |
@@ -360,7 +362,7 @@ discard block |
||
360 | 362 | * Waits for signals, with a timeout |
361 | 363 | * @param int Seconds |
362 | 364 | * @param int Nanoseconds |
363 | - * @return void |
|
365 | + * @return boolean |
|
364 | 366 | */ |
365 | 367 | protected function sigwait($sec = 0, $nano = 0.3e9) { |
366 | 368 | $siginfo = NULL; |
@@ -382,6 +384,11 @@ discard block |
||
382 | 384 | |
383 | 385 | if (!function_exists('pcntl_sigtimedwait')) { |
384 | 386 | // @todo $signals or Thread::$signals? |
387 | + |
|
388 | + /** |
|
389 | + * @param integer $sec |
|
390 | + * @param double $nano |
|
391 | + */ |
|
385 | 392 | function pcntl_sigtimedwait($signals, $siginfo, $sec, $nano) { |
386 | 393 | pcntl_signal_dispatch(); |
387 | 394 |
@@ -48,6 +48,10 @@ |
||
48 | 48 | $obj = new self($cb, $timeout, $id, $priority); |
49 | 49 | return $obj->id; |
50 | 50 | } |
51 | + |
|
52 | + /** |
|
53 | + * @param integer $timeout |
|
54 | + */ |
|
51 | 55 | public static function setTimeout($id, $timeout = NULL) { |
52 | 56 | if (isset(Timer::$list[$id])) { |
53 | 57 | Timer::$list[$id]->timeout($timeout); |
@@ -19,6 +19,9 @@ discard block |
||
19 | 19 | |
20 | 20 | public static $zombie = 0; |
21 | 21 | |
22 | + /** |
|
23 | + * @param string $name |
|
24 | + */ |
|
22 | 25 | public function request($addr, $name, $data, $cb) { |
23 | 26 | $e = explode(':', $addr); |
24 | 27 | $this->getConnection('valve://[udp:' . $e[0] . ']' . (isset($e[1]) ? ':'.$e[1] : '') . '/', function($conn) use ($cb, $addr, $data, $name) { |
@@ -90,6 +93,9 @@ discard block |
||
90 | 93 | $this->request('info', null, $cb); |
91 | 94 | } |
92 | 95 | |
96 | + /** |
|
97 | + * @param string $name |
|
98 | + */ |
|
93 | 99 | public function request($name, $data = null, $cb = null) { |
94 | 100 | $packet = "\xFF\xFF\xFF\xFF"; |
95 | 101 | if ($name === 'ping') { |
@@ -12,10 +12,16 @@ discard block |
||
12 | 12 | const STRING = NULL; |
13 | 13 | const BINARY = NULL; |
14 | 14 | |
15 | + /** |
|
16 | + * @param WebSocketServerConnection $connection |
|
17 | + */ |
|
15 | 18 | public function __construct($connection) { |
16 | 19 | $this->connection = $connection; |
17 | 20 | } |
18 | 21 | |
22 | + /** |
|
23 | + * @return integer |
|
24 | + */ |
|
19 | 25 | public function getFrameType($type) { |
20 | 26 | if (is_int($type)) { |
21 | 27 | return $type; |
@@ -45,7 +51,7 @@ discard block |
||
45 | 51 | /** |
46 | 52 | * Returns handshaked data for reply |
47 | 53 | * @param string Received data (no use in this class) |
48 | - * @return string Handshaked data |
|
54 | + * @return boolean Handshaked data |
|
49 | 55 | */ |
50 | 56 | |
51 | 57 | public function getHandshakeReply($data) { |
@@ -16,6 +16,9 @@ discard block |
||
16 | 16 | public $opcodes; |
17 | 17 | public $outgoingCompression = 0; |
18 | 18 | |
19 | + /** |
|
20 | + * @param WebSocketServerConnection $connection |
|
21 | + */ |
|
19 | 22 | public function __construct($connection) { |
20 | 23 | $this->connection = $connection; |
21 | 24 | $this->opcodes = array( |
@@ -95,6 +98,9 @@ discard block |
||
95 | 98 | return $this->encodeFragment($data, $type, $fin, $rsv1, $rsv2, $rsv3); |
96 | 99 | } |
97 | 100 | |
101 | + /** |
|
102 | + * @param string $type |
|
103 | + */ |
|
98 | 104 | protected function encodeFragment($data, $type, $fin = 1, $rsv1 = 0, $rsv2 = 0, $rsv3 = 0) { |
99 | 105 | $mask = chr(rand(0, 0xFF)) . |
100 | 106 | chr(rand(0, 0xFF)) . |
@@ -132,6 +138,12 @@ discard block |
||
132 | 138 | } |
133 | 139 | return $packet; |
134 | 140 | } |
141 | + |
|
142 | + /** |
|
143 | + * @param string $mask |
|
144 | + * |
|
145 | + * @return string |
|
146 | + */ |
|
135 | 147 | public function mask ($data, $mask) { |
136 | 148 | for ($i = 0, $l = strlen($data), $ml = strlen($mask); $i < $l; $i++) { |
137 | 149 | $data[$i] = $data[$i] ^ $mask[$i % $ml] ; |
@@ -142,6 +154,7 @@ discard block |
||
142 | 154 | * Converts binary string to integer |
143 | 155 | * @param string Binary string |
144 | 156 | * @param boolean Optional. Little endian. Default value - false. |
157 | + * @param string $str |
|
145 | 158 | * @return integer Resulting integer |
146 | 159 | */ |
147 | 160 | public function bytes2int($str, $l = FALSE) |
@@ -151,6 +151,7 @@ discard block |
||
151 | 151 | |
152 | 152 | /** |
153 | 153 | * Called when we're going to handshake. |
154 | + * @param string $data |
|
154 | 155 | * @return boolean Handshake status |
155 | 156 | */ |
156 | 157 | |
@@ -197,6 +198,7 @@ discard block |
||
197 | 198 | /** |
198 | 199 | * Called when new data received. |
199 | 200 | * @param string New received data. |
201 | + * @param string $buf |
|
200 | 202 | * @return void |
201 | 203 | */ |
202 | 204 |
@@ -17,6 +17,9 @@ discard block |
||
17 | 17 | xml_set_character_data_handler($this->parser, 'charXML'); |
18 | 18 | } |
19 | 19 | |
20 | + /** |
|
21 | + * @param string $ns |
|
22 | + */ |
|
20 | 23 | public function setDefaultNS($ns) { |
21 | 24 | $this->default_ns = $ns; |
22 | 25 | } |
@@ -164,8 +167,7 @@ discard block |
||
164 | 167 | * Add ID Handler |
165 | 168 | * |
166 | 169 | * @param integer $id |
167 | - * @param string $pointer |
|
168 | - * @param string $obj |
|
170 | + * @param Closure $cb |
|
169 | 171 | */ |
170 | 172 | public function addIdHandler($id, $cb) { |
171 | 173 | if ($cb === null) { |
@@ -196,8 +198,8 @@ discard block |
||
196 | 198 | * Add XPath Handler |
197 | 199 | * |
198 | 200 | * @param string $xpath |
199 | - * @param string $pointer |
|
200 | 201 | * @param |
202 | + * @param Closure $cb |
|
201 | 203 | */ |
202 | 204 | public function addXPathHandler($xpath, $cb, $obj = null) { |
203 | 205 | if (preg_match_all("/\(?{[^\}]+}\)?(\/?)[^\/]+/", $xpath, $regs)) { |