8bcac421a63b81c4f8298e9e0530757d8ad9b507
[m6w6/atick] / lib / atick / Able.php
1 <?php
2
3 namespace atick;
4
5 interface Able
6 {
7 const CLOSED = 0;
8 const READABLE = 1;
9 const WRITABLE = 2;
10
11 /**
12 * Register any output streams with the ticker
13 * @param \atick\Ticker $ticker
14 * @param callable $verify
15 */
16 function with(Ticker $ticker, callable $verify = null);
17
18 /**
19 * Pass data to the input stream
20 * @param string $data
21 */
22 function write($data);
23
24 /**
25 * Where to send output to
26 * @param resource|callable $into
27 * @return \atick\Able
28 */
29 function read($into);
30
31 /**
32 * Where to send error output to
33 * @param resource|callable $into
34 * @return \atick\Able
35 */
36 function error($into);
37
38 /**
39 * Whether the pipe/proc is alive
40 * @return int
41 */
42 function stat();
43
44 /**
45 * Shutdown the pipe/proc
46 * @param int $what
47 */
48 function close($what = self::CLOSED);
49 }