本文整理汇总了PHP中registry::grab方法的典型用法代码示例。如果您正苦于以下问题:PHP registry::grab方法的具体用法?PHP registry::grab怎么用?PHP registry::grab使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类registry
的用法示例。
在下文中一共展示了registry::grab方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __get
public function __get($name)
{
if (isset($this->_class_index[$name])) {
$obj = registry::grab($this->_class_index[$name][0], $this->_class_index[$name][1]);
if ($obj) {
return $obj;
}
}
if (!$this->_shorts_loaded) {
$this->_shorts = static::__shortcuts();
$this->_shorts_loaded = true;
}
$obj = false;
if (isset($this->_shorts[$name])) {
if (is_array($this->_shorts[$name])) {
$obj = registry::register($this->_shorts[$name][0], $this->_shorts[$name][1]);
} else {
$obj = registry::register($this->_shorts[$name]);
}
} elseif (isset(registry::$aliases[$name])) {
if (is_array(registry::$aliases[$name])) {
$obj = registry::register(registry::$aliases[$name][0], registry::$aliases[$name][1]);
} else {
$obj = registry::register(registry::$aliases[$name]);
}
} elseif (registry::class_exists($name)) {
$obj = registry::register($name);
}
if ($obj) {
$this->_class_index[$name] = array(get_class($obj), $obj->class_hash);
return $obj;
}
if ($const = registry::get_const($name)) {
return $const;
}
return null;
}