Commit a6eec17e authored by Ghislain Loas's avatar Ghislain Loas
Browse files

HelperBroker statics call statically, and prey

parent 6333c15e
...@@ -76,7 +76,7 @@ class Zend_Controller_Action_HelperBroker ...@@ -76,7 +76,7 @@ class Zend_Controller_Action_HelperBroker
*/ */
static public function addHelper(Zend_Controller_Action_Helper_Abstract $helper) static public function addHelper(Zend_Controller_Action_Helper_Abstract $helper)
{ {
self::getStack()->push($helper); static::getStack()->push($helper);
return; return;
} }
...@@ -89,7 +89,7 @@ class Zend_Controller_Action_HelperBroker ...@@ -89,7 +89,7 @@ class Zend_Controller_Action_HelperBroker
{ {
$prefix = rtrim($prefix, '_'); $prefix = rtrim($prefix, '_');
$path = str_replace('_', DIRECTORY_SEPARATOR, $prefix); $path = str_replace('_', DIRECTORY_SEPARATOR, $prefix);
self::addPath($path, $prefix); static::addPath($path, $prefix);
return; return;
} }
...@@ -100,7 +100,7 @@ class Zend_Controller_Action_HelperBroker ...@@ -100,7 +100,7 @@ class Zend_Controller_Action_HelperBroker
*/ */
static public function resetHelpers() static public function resetHelpers()
{ {
self::$_stack = null; static::$_stack = null;
return; return;
} }
...@@ -124,7 +124,7 @@ class Zend_Controller_Action_HelperBroker ...@@ -124,7 +124,7 @@ class Zend_Controller_Action_HelperBroker
$info['dir'] = $path; $info['dir'] = $path;
$info['prefix'] = $prefix; $info['prefix'] = $prefix;
self::$_paths[] = $info; static::$_paths[] = $info;
return; return;
} }
...@@ -137,7 +137,7 @@ class Zend_Controller_Action_HelperBroker ...@@ -137,7 +137,7 @@ class Zend_Controller_Action_HelperBroker
public function __construct(Zend_Controller_Action $actionController) public function __construct(Zend_Controller_Action $actionController)
{ {
$this->_actionController = $actionController; $this->_actionController = $actionController;
foreach (self::getStack() as $helper) { foreach (static::getStack() as $helper) {
$helper->setActionController($actionController); $helper->setActionController($actionController);
$helper->init(); $helper->init();
} }
...@@ -150,7 +150,7 @@ class Zend_Controller_Action_HelperBroker ...@@ -150,7 +150,7 @@ class Zend_Controller_Action_HelperBroker
*/ */
public function notifyPreDispatch() public function notifyPreDispatch()
{ {
foreach (self::getStack() as $helper) { foreach (static::getStack() as $helper) {
$helper->preDispatch(); $helper->preDispatch();
} }
} }
...@@ -162,7 +162,7 @@ class Zend_Controller_Action_HelperBroker ...@@ -162,7 +162,7 @@ class Zend_Controller_Action_HelperBroker
*/ */
public function notifyPostDispatch() public function notifyPostDispatch()
{ {
foreach (self::getStack() as $helper) { foreach (static::getStack() as $helper) {
$helper->postDispatch(); $helper->postDispatch();
} }
} }
...@@ -190,12 +190,12 @@ class Zend_Controller_Action_HelperBroker ...@@ -190,12 +190,12 @@ class Zend_Controller_Action_HelperBroker
*/ */
public function getHelper($name) public function getHelper($name)
{ {
$name = self::_normalizeHelperName($name); $name = static::_normalizeHelperName($name);
$stack = static::getStack();
$stack = self::getStack();
if (!isset($stack->{$name})) { if (!isset($stack->{$name})) {
self::_loadHelper($name); static::_loadHelper($name);
} }
$helper = $stack->{$name}; $helper = $stack->{$name};
...@@ -227,12 +227,12 @@ class Zend_Controller_Action_HelperBroker ...@@ -227,12 +227,12 @@ class Zend_Controller_Action_HelperBroker
*/ */
public static function getStaticHelper($name) public static function getStaticHelper($name)
{ {
$name = self::_normalizeHelperName($name); $name = static::_normalizeHelperName($name);
$stack = static::getStack();
$stack = self::getStack();
if (!isset($stack->{$name})) { if (!isset($stack->{$name})) {
self::_loadHelper($name); static::_loadHelper($name);
} }
$helper = $stack->{$name}; $helper = $stack->{$name};
...@@ -257,10 +257,10 @@ class Zend_Controller_Action_HelperBroker ...@@ -257,10 +257,10 @@ class Zend_Controller_Action_HelperBroker
*/ */
public static function getExistingHelper($name) public static function getExistingHelper($name)
{ {
$name = self::_normalizeHelperName($name); $name = static::_normalizeHelperName($name);
$stack = static::getStack();
$stack = self::getStack();
if (isset($stack->{$name})) { if (isset($stack->{$name})) {
return $stack->{$name}; return $stack->{$name};
} }
...@@ -275,7 +275,7 @@ class Zend_Controller_Action_HelperBroker ...@@ -275,7 +275,7 @@ class Zend_Controller_Action_HelperBroker
*/ */
public static function getExistingHelpers() public static function getExistingHelpers()
{ {
return self::getStack()->getHelpersByName(); return static::getStack()->getHelpersByName();
} }
/** /**
...@@ -286,8 +286,8 @@ class Zend_Controller_Action_HelperBroker ...@@ -286,8 +286,8 @@ class Zend_Controller_Action_HelperBroker
*/ */
public static function hasHelper($name) public static function hasHelper($name)
{ {
$name = self::_normalizeHelperName($name); $name = static::_normalizeHelperName($name);
return isset(self::getStack()->{$name}); return isset(static::getStack()->{$name});
} }
/** /**
...@@ -298,8 +298,8 @@ class Zend_Controller_Action_HelperBroker ...@@ -298,8 +298,8 @@ class Zend_Controller_Action_HelperBroker
*/ */
public static function removeHelper($name) public static function removeHelper($name)
{ {
$name = self::_normalizeHelperName($name); $name = static::_normalizeHelperName($name);
$stack = self::getStack(); $stack = static::getStack();
if (isset($stack->{$name})) { if (isset($stack->{$name})) {
unset($stack->{$name}); unset($stack->{$name});
} }
...@@ -314,13 +314,13 @@ class Zend_Controller_Action_HelperBroker ...@@ -314,13 +314,13 @@ class Zend_Controller_Action_HelperBroker
*/ */
public static function getStack() public static function getStack()
{ {
if (self::$_stack == null) { if (static::$_stack == null) {
self::$_stack = new Zend_Controller_Action_HelperBroker_PriorityStack(); static::$_stack = new Zend_Controller_Action_HelperBroker_PriorityStack();
} }
return self::$_stack; return static::$_stack;
} }
/** /**
* _loadHelper() * _loadHelper()
* *
...@@ -331,7 +331,7 @@ class Zend_Controller_Action_HelperBroker ...@@ -331,7 +331,7 @@ class Zend_Controller_Action_HelperBroker
{ {
$file = $name . '.php'; $file = $name . '.php';
$paths = array_reverse(self::$_paths); $paths = array_reverse(static::$_paths);
foreach ($paths as $info) { foreach ($paths as $info) {
$dir = $info['dir']; $dir = $info['dir'];
$prefix = $info['prefix']; $prefix = $info['prefix'];
...@@ -345,7 +345,7 @@ class Zend_Controller_Action_HelperBroker ...@@ -345,7 +345,7 @@ class Zend_Controller_Action_HelperBroker
throw new Zend_Controller_Action_Exception('Helper name ' . $name . ' -> class ' . $class . ' is not of type Zend_Controller_Action_Helper_Abstract'); throw new Zend_Controller_Action_Exception('Helper name ' . $name . ' -> class ' . $class . ' is not of type Zend_Controller_Action_Helper_Abstract');
} }
self::getStack()->push($helper); static::getStack()->push($helper);
return; return;
} elseif (Zend_Loader::isReadable($dir . $file)) { } elseif (Zend_Loader::isReadable($dir . $file)) {
...@@ -357,7 +357,7 @@ class Zend_Controller_Action_HelperBroker ...@@ -357,7 +357,7 @@ class Zend_Controller_Action_HelperBroker
throw new Zend_Controller_Action_Exception('Helper name ' . $name . ' -> class ' . $class . ' is not of type Zend_Controller_Action_Helper_Abstract'); throw new Zend_Controller_Action_Exception('Helper name ' . $name . ' -> class ' . $class . ' is not of type Zend_Controller_Action_Helper_Abstract');
} }
self::getStack()->push($helper); static::getStack()->push($helper);
return; return;
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment