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 / View / Console / InjectNamedConsoleParamsListener.php
blob39901af241b407687b583002a0ecf61d1671b245
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\View\Console;
12 use Zend\Console\Request as ConsoleRequest;
13 use Zend\EventManager\AbstractListenerAggregate;
14 use Zend\EventManager\EventManagerInterface as Events;
15 use Zend\Mvc\MvcEvent;
17 class InjectNamedConsoleParamsListener extends AbstractListenerAggregate
19 /**
20 * {@inheritDoc}
22 public function attach(Events $events)
24 $this->listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH, array($this, 'injectNamedParams'), -80);
27 /**
28 * Inspect the result, and cast it to a ViewModel if a string is detected
30 * @param MvcEvent $e
31 * @return void
33 public function injectNamedParams(MvcEvent $e)
35 if (!$routeMatch = $e->getRouteMatch()) {
36 return; // cannot work without route match
39 $request = $e->getRequest();
40 if (!$request instanceof ConsoleRequest) {
41 return; // will not inject non-console requests
44 // Inject route match params into request
45 $params = array_merge(
46 $request->getParams()->toArray(),
47 $routeMatch->getParams()
49 $request->getParams()->fromArray($params);