31 class_exists(
'Guzzle\Http\Message\Response');
32 class_exists(
'Guzzle\Http\Exception\CurlException');
37 $this->queued[] = $request;
45 foreach ($this->handles as $handle) {
46 $requests = array_merge($requests, $handle->all());
54 foreach ($this->queued as $i => $r) {
55 if ($request === $r) {
56 unset($this->queued[$i]);
61 foreach ($this->handles as $handle) {
62 if ($handle->remove($request)) {
70 public function reset($hard =
false)
72 $this->queued = array();
73 $this->groups = array();
74 foreach ($this->handles as $handle) {
78 $this->handles = array();
89 $this->groups[] = $group;
90 while ($request = array_shift($this->queued)) {
91 $group->add($request);
95 array_pop($this->groups);
97 }
catch (\Exception $e) {
99 if (!$group->count()) {
100 array_pop($this->groups);
121 foreach ($this->handles as $h) {
122 if (!in_array($h, $this->groups,
true)) {
128 $handle =
new CurlMulti($this->selectTimeout);
130 $this->handles[] = $handle;
140 if ($diff = max(0,
count($this->handles) - $this->maxHandles)) {
141 for ($i =
count($this->handles) - 1; $i > 0 && $diff > 0; $i--) {
142 if (!
count($this->handles[$i])) {
143 unset($this->handles[$i]);
147 $this->handles = array_values($this->handles);