Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / Mvc / ResponseSender / SendResponseEvent.php
blob9af372ddf202f414c2002d75cec9a5c2577302c2
1 <?php
2 /**
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
8 */
10 namespace Zend\Mvc\ResponseSender;
12 use Zend\EventManager\Event;
13 use Zend\Stdlib\ResponseInterface;
15 class SendResponseEvent extends Event
17 /**#@+
18 * Send response events triggered by eventmanager
20 const EVENT_SEND_RESPONSE = 'sendResponse';
21 /**#@-*/
23 /**
24 * @var string Event name
26 protected $name = 'sendResponse';
28 /**
29 * @var ResponseInterface
31 protected $response;
33 /**
34 * @var array
36 protected $headersSent = array();
38 /**
39 * @var array
41 protected $contentSent = array();
43 /**
44 * @param ResponseInterface $response
45 * @return SendResponseEvent
47 public function setResponse(ResponseInterface $response)
49 $this->setParam('response', $response);
50 $this->response = $response;
51 return $this;
54 /**
55 * @return \Zend\Stdlib\ResponseInterface
57 public function getResponse()
59 return $this->response;
62 /**
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;
74 return $this;
77 /**
78 * @return bool
80 public function contentSent()
82 $response = $this->getResponse();
83 if (isset($this->contentSent[spl_object_hash($response)])) {
84 return true;
86 return false;
89 /**
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;
101 return $this;
105 * @return bool
107 public function headersSent()
109 $response = $this->getResponse();
110 if (isset($this->headersSent[spl_object_hash($response)])) {
111 return true;
113 return false;