1 | <?php |
||
25 | class Dispatcher implements DispatcherInterface |
||
26 | { |
||
27 | /** |
||
28 | * The cURL multi handle. |
||
29 | * |
||
30 | * @var resource |
||
31 | */ |
||
32 | protected $handle; |
||
33 | |||
34 | /** |
||
35 | * All added requests. |
||
36 | * |
||
37 | * @var array |
||
38 | */ |
||
39 | protected $requests = []; |
||
40 | |||
41 | /** |
||
42 | * The size of each request stack. |
||
43 | * |
||
44 | * @var integer |
||
45 | */ |
||
46 | protected $stackSize = 42; |
||
47 | |||
48 | /** |
||
49 | * Constructs a `Dispatcher` instance. |
||
50 | */ |
||
51 | public function __construct() |
||
55 | |||
56 | /** |
||
57 | * {@inheritdoc} |
||
58 | */ |
||
59 | public function add(RequestInterface $request) |
||
64 | |||
65 | /** |
||
66 | * {@inheritdoc} |
||
67 | */ |
||
68 | public function all() |
||
72 | |||
73 | /** |
||
74 | * {@inheritdoc} |
||
75 | */ |
||
76 | public function clear() |
||
80 | |||
81 | /** |
||
82 | * {@inheritdoc} |
||
83 | */ |
||
84 | public function execute(callable $callback = null) |
||
118 | |||
119 | /** |
||
120 | * {@inheritdoc} |
||
121 | */ |
||
122 | public function get($key) |
||
127 | |||
128 | /** |
||
129 | * Retrieves the maximum stack size. |
||
130 | * |
||
131 | * @return integer |
||
132 | */ |
||
133 | public function getStackSize() |
||
137 | |||
138 | /** |
||
139 | * {@inheritdoc} |
||
140 | */ |
||
141 | public function remove($key) |
||
149 | |||
150 | /** |
||
151 | * Sets the maximum stack size. |
||
152 | * |
||
153 | * @param integer $size |
||
154 | */ |
||
155 | public function setStackSize($size) |
||
163 | |||
164 | /** |
||
165 | * Builds stacks of requests. |
||
166 | * |
||
167 | * @return array |
||
168 | */ |
||
169 | protected function buildStacks() |
||
187 | |||
188 | /** |
||
189 | * Dispatches all requests in the stack. |
||
190 | */ |
||
191 | protected function dispatch() |
||
207 | |||
208 | /** |
||
209 | * Processes all requests. |
||
210 | * |
||
211 | * @return array |
||
212 | */ |
||
213 | protected function process() |
||
226 | } |
||
227 |