diff options
Diffstat (limited to 'apps/files_external/3rdparty/aws-sdk-php/Guzzle/Plugin/Mock/MockPlugin.php')
-rw-r--r-- | apps/files_external/3rdparty/aws-sdk-php/Guzzle/Plugin/Mock/MockPlugin.php | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/apps/files_external/3rdparty/aws-sdk-php/Guzzle/Plugin/Mock/MockPlugin.php b/apps/files_external/3rdparty/aws-sdk-php/Guzzle/Plugin/Mock/MockPlugin.php index ab7833cee2c..2440578cf08 100644 --- a/apps/files_external/3rdparty/aws-sdk-php/Guzzle/Plugin/Mock/MockPlugin.php +++ b/apps/files_external/3rdparty/aws-sdk-php/Guzzle/Plugin/Mock/MockPlugin.php @@ -226,17 +226,20 @@ class MockPlugin extends AbstractHasDispatcher implements EventSubscriberInterfa * Called when a request is about to be sent * * @param Event $event + * @throws \OutOfBoundsException When queue is empty */ public function onRequestBeforeSend(Event $event) { - if ($this->queue) { - $request = $event['request']; - $this->received[] = $request; - // Detach the filter from the client so it's a one-time use - if ($this->temporary && count($this->queue) == 1 && $request->getClient()) { - $request->getClient()->getEventDispatcher()->removeSubscriber($this); - } - $this->dequeue($request); + if (!$this->queue) { + throw new \OutOfBoundsException('Mock queue is empty'); + } + + $request = $event['request']; + $this->received[] = $request; + // Detach the filter from the client so it's a one-time use + if ($this->temporary && count($this->queue) == 1 && $request->getClient()) { + $request->getClient()->getEventDispatcher()->removeSubscriber($this); } + $this->dequeue($request); } } |