Source for file PresenterComponentReflection.php
Documentation is available at PresenterComponentReflection.php
6: * @copyright Copyright (c) 2004, 2010 David Grudl
7: * @license http://nettephp.com/license Nette license
8: * @link http://nettephp.com
10: * @package Nette\Application
16: * Helpers for Presenter & PresenterComponent.
18: * @copyright Copyright (c) 2004, 2010 David Grudl
19: * @package Nette\Application
24: /** @var array getPersistentParams cache */
25: private static $ppCache =
array();
27: /** @var array getPersistentComponents cache */
28: private static $pcCache =
array();
30: /** @var array isMethodCallable cache */
31: private static $mcCache =
array();
36: * @return array of persistent parameters.
38: public function getPersistentParams($class =
NULL)
40: $class =
$class ===
NULL ?
$this->getName() :
$class; // TODO
41: $params =
& self::$ppCache[$class];
42: if ($params !==
NULL) return $params;
45: // $class::getPersistentParams() in PHP 5.3
47: foreach (call_user_func(array($class, 'getPersistentParams'), $class) as $name =>
$meta) {
49: $params[$name] =
array(
50: 'def' =>
$defaults[$name],
62: * @return array of persistent components.
64: public function getPersistentComponents()
66: $class =
$this->getName();
67: $components =
& self::$pcCache[$class];
68: if ($components !==
NULL) return $components;
69: $components =
array();
71: // $class::getPersistentComponents() in PHP 5.3
72: foreach (call_user_func(array($class, 'getPersistentComponents'), $class) as $name =>
$meta) {
74: $components[$name] =
array('since' =>
$class);
84: * Is a method callable? It means class is instantiable and method has
85: * public visibility, is non-static and non-abstract.
86: * @param string method name
89: public function hasCallableMethod($method)
91: $class =
$this->getName();
92: $cache =
& self::$mcCache[strtolower($class .
':' .
$method)];
93: if ($cache ===
NULL) try {
96: $cache =
$this->isInstantiable() &&
$rm->isPublic() &&
!$rm->isAbstract() &&
!$rm->isStatic();
97: } catch (ReflectionException $e) {