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 / MvcEvent.php
blob06c7dfa873a84838f6d978b9b0785c95be023ade
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;
12 use Zend\EventManager\Event;
13 use Zend\Stdlib\RequestInterface as Request;
14 use Zend\Stdlib\ResponseInterface as Response;
15 use Zend\View\Model\ModelInterface as Model;
16 use Zend\View\Model\ViewModel;
18 class MvcEvent extends Event
20 /**#@+
21 * Mvc events triggered by eventmanager
23 const EVENT_BOOTSTRAP = 'bootstrap';
24 const EVENT_DISPATCH = 'dispatch';
25 const EVENT_DISPATCH_ERROR = 'dispatch.error';
26 const EVENT_FINISH = 'finish';
27 const EVENT_RENDER = 'render';
28 const EVENT_RENDER_ERROR = 'render.error';
29 const EVENT_ROUTE = 'route';
30 /**#@-*/
32 protected $application;
34 /**
35 * @var Request
37 protected $request;
39 /**
40 * @var Response
42 protected $response;
44 /**
45 * @var mixed
47 protected $result;
49 /**
50 * @var Router\RouteStackInterface
52 protected $router;
54 /**
55 * @var Router\RouteMatch
57 protected $routeMatch;
59 /**
60 * @var Model
62 protected $viewModel;
64 /**
65 * Set application instance
67 * @param ApplicationInterface $application
68 * @return MvcEvent
70 public function setApplication(ApplicationInterface $application)
72 $this->setParam('application', $application);
73 $this->application = $application;
74 return $this;
77 /**
78 * Get application instance
80 * @return ApplicationInterface
82 public function getApplication()
84 return $this->application;
87 /**
88 * Get router
90 * @return Router\RouteStackInterface
92 public function getRouter()
94 return $this->router;
97 /**
98 * Set router
100 * @param Router\RouteStackInterface $router
101 * @return MvcEvent
103 public function setRouter(Router\RouteStackInterface $router)
105 $this->setParam('router', $router);
106 $this->router = $router;
107 return $this;
111 * Get route match
113 * @return Router\RouteMatch
115 public function getRouteMatch()
117 return $this->routeMatch;
121 * Set route match
123 * @param Router\RouteMatch $matches
124 * @return MvcEvent
126 public function setRouteMatch(Router\RouteMatch $matches)
128 $this->setParam('route-match', $matches);
129 $this->routeMatch = $matches;
130 return $this;
134 * Get request
136 * @return Request
138 public function getRequest()
140 return $this->request;
144 * Set request
146 * @param Request $request
147 * @return MvcEvent
149 public function setRequest(Request $request)
151 $this->setParam('request', $request);
152 $this->request = $request;
153 return $this;
157 * Get response
159 * @return Response
161 public function getResponse()
163 return $this->response;
167 * Set response
169 * @param Response $response
170 * @return MvcEvent
172 public function setResponse(Response $response)
174 $this->setParam('response', $response);
175 $this->response = $response;
176 return $this;
180 * Set the view model
182 * @param Model $viewModel
183 * @return MvcEvent
185 public function setViewModel(Model $viewModel)
187 $this->viewModel = $viewModel;
188 return $this;
192 * Get the view model
194 * @return Model
196 public function getViewModel()
198 if (null === $this->viewModel) {
199 $this->setViewModel(new ViewModel());
201 return $this->viewModel;
205 * Get result
207 * @return mixed
209 public function getResult()
211 return $this->result;
215 * Set result
217 * @param mixed $result
218 * @return MvcEvent
220 public function setResult($result)
222 $this->setParam('__RESULT__', $result);
223 $this->result = $result;
224 return $this;
228 * Does the event represent an error response?
230 * @return bool
232 public function isError()
234 return (bool) $this->getParam('error', false);
238 * Set the error message (indicating error in handling request)
240 * @param string $message
241 * @return MvcEvent
243 public function setError($message)
245 $this->setParam('error', $message);
246 return $this;
250 * Retrieve the error message, if any
252 * @return string
254 public function getError()
256 return $this->getParam('error', '');
260 * Get the currently registered controller name
262 * @return string
264 public function getController()
266 return $this->getParam('controller');
270 * Set controller name
272 * @param string $name
273 * @return MvcEvent
275 public function setController($name)
277 $this->setParam('controller', $name);
278 return $this;
282 * Get controller class
284 * @return string
286 public function getControllerClass()
288 return $this->getParam('controller-class');
292 * Set controller class
294 * @param string $class
295 * @return MvcEvent
297 public function setControllerClass($class)
299 $this->setParam('controller-class', $class);
300 return $this;