1: <?php
2:
3: namespace PHPFastCGI\FastCGIDaemon\Connection;
4:
5: use PHPFastCGI\FastCGIDaemon\Exception\ConnectionException;
6:
7: /**
8: * The connection interface defines a set of methods that abstract operations
9: * on incoming connections from the method by which they were accepted.
10: */
11: interface ConnectionInterface
12: {
13: /**
14: * Read data from the connection.
15: *
16: * @param int $length Number of bytes to read
17: *
18: * @return string Buffer containing the read data
19: *
20: * @throws ConnectionException On failure
21: */
22: public function read($length);
23:
24: /**
25: * Write data to the connection.
26: *
27: * @param string $buffer Buffer containing the data to write
28: *
29: * @throws ConnectionException On failure
30: */
31: public function write($buffer);
32:
33: /**
34: * Tests to see if the connection has been closed.
35: *
36: * @return bool True if the connection has been closed, false otherwise
37: */
38: public function isClosed();
39:
40: /**
41: * Closes the connection it from the pool.
42: */
43: public function close();
44: }
45: