<?PHP
NAMESPACE ILLI\Core\Proto;
USE ILLI\Core\Exception;
USE ILLI\Core\Proto\I_Boot;
TRAIT T_Boot
{
private static $__Core_Proto_T_Boot_Static = [];
protected function Core_Proto_T_Boot_handleLookup($propertyName, $lookupClassName, array $classCache)
{
if(FALSE === isset($classCache[$propertyName]))
return
[
I_Boot::EXISTS => isset($this->$propertyName) || property_exists($this, $propertyName),
I_Boot::DEFINED => $lookupClassName,
I_Boot::REDEFINED => FALSE,
I_Boot::INSPECT => $lookupClassName.'::$'.$propertyName
];
$r = $classCache[$propertyName];
if(FALSE === $r[I_Boot::REDEFINED])
{
$r[I_Boot::REDEFINED] = $r[I_Boot::DEFINED];
$r[I_Boot::INSPECT] = $r[I_Boot::DEFINED].'::$'.$propertyName;
}
$r[I_Boot::DEFINED] = $lookupClassName;
return $r;
}
protected function Core_Proto_T_Boot_emit(array $__lookupTable = [])
{
array_walk($__lookupTable, function($t, $p)
{
if(is_integer($p))
{
$p = $t;
$t = [];
}
$l = get_called_class();
$s = &self::$__Core_Proto_T_Boot_Static[$l][$p];
if(isset($s))
goto _init;
$c = [];
do
{
if(FALSE === isset($l::$$p))
continue;
$c = is_callable($h = isset($t[I_Boot::ON_LOOKUP]) ? $t[I_Boot::ON_LOOKUP] : NULL)
? $h($c, $l, $l::$$p)
: $l::$$p;
}
while($l = get_parent_class($l));
$s = is_callable($h = isset($t[I_Boot::ON_COMPLETE]) ? $t[I_Boot::ON_COMPLETE] : NULL)
? $h($c)
: $c;
_init:
if(is_callable($h = isset($t[I_Boot::ON_INIT]) ? $t[I_Boot::ON_INIT] : NULL))
$h($s);
});
return $this;
}
}
Comments