1: <?php
2:
3: namespace Guzzle\Http\Curl;
4:
5: use Guzzle\Common\HasDispatcherInterface;
6: use Guzzle\Common\Exception\ExceptionCollection;
7: use Guzzle\Http\Message\RequestInterface;
8:
9: /**
10: * Interface for sending a pool of {@see RequestInterface} objects in parallel
11: */
12: interface CurlMultiInterface extends \Countable, HasDispatcherInterface
13: {
14: const POLLING_REQUEST = 'curl_multi.polling_request';
15: const ADD_REQUEST = 'curl_multi.add_request';
16: const REMOVE_REQUEST = 'curl_multi.remove_request';
17: const MULTI_EXCEPTION = 'curl_multi.exception';
18: const BLOCKING = 'curl_multi.blocking';
19:
20: /**
21: * Add a request to the pool.
22: *
23: * @param RequestInterface $request Request to add
24: *
25: * @return CurlMultiInterface
26: */
27: public function add(RequestInterface $request);
28:
29: /**
30: * Get an array of attached {@see RequestInterface} objects
31: *
32: * @return array
33: */
34: public function all();
35:
36: /**
37: * Remove a request from the pool.
38: *
39: * @param RequestInterface $request Request to remove
40: *
41: * @return bool Returns true on success or false on failure
42: */
43: public function remove(RequestInterface $request);
44:
45: /**
46: * Reset the state and remove any attached RequestInterface objects
47: *
48: * @param bool $hard Set to true to close and reopen any open multi handles
49: */
50: public function reset($hard = false);
51:
52: /**
53: * Send a pool of {@see RequestInterface} requests.
54: *
55: * @throws ExceptionCollection if any requests threw exceptions during the transfer.
56: */
57: public function send();
58: }
59: