3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
10 namespace Zend\Mvc\ResponseSender
;
12 use Zend\EventManager\Event
;
13 use Zend\Stdlib\ResponseInterface
;
15 class SendResponseEvent
extends Event
18 * Send response events triggered by eventmanager
20 const EVENT_SEND_RESPONSE
= 'sendResponse';
24 * @var string Event name
26 protected $name = 'sendResponse';
29 * @var ResponseInterface
36 protected $headersSent = array();
41 protected $contentSent = array();
44 * @param ResponseInterface $response
45 * @return SendResponseEvent
47 public function setResponse(ResponseInterface
$response)
49 $this->setParam('response', $response);
50 $this->response
= $response;
55 * @return \Zend\Stdlib\ResponseInterface
57 public function getResponse()
59 return $this->response
;
63 * Set content sent for current response
65 * @return SendResponseEvent
67 public function setContentSent()
69 $response = $this->getResponse();
70 $contentSent = $this->getParam('contentSent', array());
71 $contentSent[spl_object_hash($response)] = true;
72 $this->setParam('contentSent', $contentSent);
73 $this->contentSent
[spl_object_hash($response)] = true;
80 public function contentSent()
82 $response = $this->getResponse();
83 if (isset($this->contentSent
[spl_object_hash($response)])) {
90 * Set headers sent for current response object
92 * @return SendResponseEvent
94 public function setHeadersSent()
96 $response = $this->getResponse();
97 $headersSent = $this->getParam('headersSent', array());
98 $headersSent[spl_object_hash($response)] = true;
99 $this->setParam('headersSent', $headersSent);
100 $this->headersSent
[spl_object_hash($response)] = true;
107 public function headersSent()
109 $response = $this->getResponse();
110 if (isset($this->headersSent
[spl_object_hash($response)])) {