本文整理匯總了PHP中Library::get_class_info方法的典型用法代碼示例。如果您正苦於以下問題:PHP Library::get_class_info方法的具體用法?PHP Library::get_class_info怎麽用?PHP Library::get_class_info使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Library
的用法示例。
在下文中一共展示了Library::get_class_info方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: find_handlers
/**
* Finds handlers in this Parser's directory.
*/
protected static function find_handlers()
{
$class_info = Library::get_class_info(get_called_class());
$handler_namespace = $class_info['namespace'] . '\\handlers';
foreach (scandir(Library::directory_from_namespace($handler_namespace)) as $file_name) {
if ($file_name[0] == '.') {
continue;
}
$handler = $handler_namespace . '\\' . Library::class_name_from_file_name($file_name);
$trigger = $handler::trigger();
if (!$trigger) {
continue;
}
if (is_array($trigger)) {
foreach ($trigger as $_trigger) {
static::$handlers[$_trigger] = $handler;
}
} else {
static::$handlers[$trigger] = $handler;
}
}
if (empty(static::$handlers)) {
throw new Exception('Sanity error: there are no handlers');
}
uksort(static::$handlers, function ($a, $b) {
if (strlen($a) < strlen($b)) {
return 1;
}
if (strlen($a) == strlen($b)) {
return 0;
}
if (strlen($a) > strlen($b)) {
return -1;
}
});
}