~tcuthbert/wordpress/openstack-objectstorage

« back to all changes in this revision

Viewing changes to vendor/guzzlehttp/guzzle/src/Event/BeforeEvent.php

  • Committer: Jacek Nykis
  • Date: 2015-02-11 15:35:31 UTC
  • Revision ID: jacek.nykis@canonical.com-20150211153531-hmy6zi0ov2qfkl0b
Initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
namespace GuzzleHttp\Event;
 
4
 
 
5
use GuzzleHttp\Message\ResponseInterface;
 
6
 
 
7
/**
 
8
 * Event object emitted before a request is sent.
 
9
 *
 
10
 * You may change the Response associated with the request using the
 
11
 * intercept() method of the event.
 
12
 */
 
13
class BeforeEvent extends AbstractRequestEvent
 
14
{
 
15
    /**
 
16
     * Intercept the request and associate a response
 
17
     *
 
18
     * @param ResponseInterface $response Response to set
 
19
     */
 
20
    public function intercept(ResponseInterface $response)
 
21
    {
 
22
        $this->getTransaction()->setResponse($response);
 
23
        $this->stopPropagation();
 
24
        RequestEvents::emitComplete($this->getTransaction());
 
25
    }
 
26
}