ZF-8809: fix errors in Barcode, Zend_Controller_Action tests
[zend/radio.git] / library / Zend / Controller / Action / Helper / Abstract.php
bloba451d378a6d19ea0750b65acc13e5cba6ca59dcd
1 <?php
2 /**
3 * Zend Framework
5 * LICENSE
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
15 * @category Zend
16 * @package Zend_Controller
17 * @subpackage Zend_Controller_Action_Helper
18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 * @version $Id$
23 /**
24 * @see Zend_Controller_Action
26 require_once 'Zend/Controller/Action.php';
28 /**
29 * @category Zend
30 * @package Zend_Controller
31 * @subpackage Zend_Controller_Action_Helper
32 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
35 abstract class Zend_Controller_Action_Helper_Abstract
37 /**
38 * $_actionController
40 * @var Zend_Controller_Action $_actionController
42 protected $_actionController = null;
44 /**
45 * @var mixed $_frontController
47 protected $_frontController = null;
49 /**
50 * setActionController()
52 * @param Zend_Controller_Action $actionController
53 * @return Zend_Controller_ActionHelper_Abstract Provides a fluent interface
55 public function setActionController(Zend_Controller_Action $actionController = null)
57 $this->_actionController = $actionController;
58 return $this;
61 /**
62 * Retrieve current action controller
64 * @return Zend_Controller_Action
66 public function getActionController()
68 return $this->_actionController;
71 /**
72 * Retrieve front controller instance
74 * @return Zend_Controller_Front
76 public function getFrontController()
78 return Zend_Controller_Front::getInstance();
81 /**
82 * Hook into action controller initialization
84 * @return void
86 public function init()
90 /**
91 * Hook into action controller preDispatch() workflow
93 * @return void
95 public function preDispatch()
99 /**
100 * Hook into action controller postDispatch() workflow
102 * @return void
104 public function postDispatch()
109 * getRequest() -
111 * @return Zend_Controller_Request_Abstract $request
113 public function getRequest()
115 $controller = $this->getActionController();
116 if (null === $controller) {
117 $controller = $this->getFrontController();
120 return $controller->getRequest();
124 * getResponse() -
126 * @return Zend_Controller_Response_Abstract $response
128 public function getResponse()
130 $controller = $this->getActionController();
131 if (null === $controller) {
132 $controller = $this->getFrontController();
135 return $controller->getResponse();
139 * getName()
141 * @return string
143 public function getName()
145 $full_class_name = get_class($this);
147 if (strpos($full_class_name, '_') !== false) {
148 $helper_name = strrchr($full_class_name, '_');
149 return ltrim($helper_name, '_');
150 } else {
151 return $full_class_name;