本文整理汇总了PHP中xp::loader方法的典型用法代码示例。如果您正苦于以下问题:PHP xp::loader方法的具体用法?PHP xp::loader怎么用?PHP xp::loader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xp
的用法示例。
在下文中一共展示了xp::loader方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
static function __static()
{
$modules = [];
self::$VARIADIC = method_exists('ReflectionParameter', 'isVariadic');
// Scan include-path, setting up classloaders for each element
foreach (\xp::$classpath as $element) {
if (DIRECTORY_SEPARATOR === $element[strlen($element) - 1]) {
$cl = FileSystemClassLoader::instanceFor($element, false);
} else {
$cl = ArchiveClassLoader::instanceFor($element, false);
}
if (isset(self::$delegates[$cl->instanceId()])) {
continue;
}
self::$delegates[$cl->instanceId()] = $cl;
if ($cl->providesResource('module.xp')) {
$modules[] = $cl;
}
}
// Initialize modules
\xp::$loader = new self();
foreach ($modules as $cl) {
self::$modules[$cl->instanceId()] = Module::register(self::declareModule($cl));
}
}
示例2: self
static function __static()
{
xp::$loader = new self();
// Scan include-path, setting up classloaders for each element
foreach (xp::$classpath as $element) {
if ('' === $element) {
continue;
} else {
if ('!' === $element[0]) {
$before = TRUE;
$element = substr($element, 1);
} else {
$before = FALSE;
}
}
$resolved = realpath($element);
if (is_dir($resolved)) {
$cl = FileSystemClassLoader::instanceFor($resolved, FALSE);
} else {
if (is_file($resolved)) {
$cl = ArchiveClassLoader::instanceFor($resolved, FALSE);
} else {
if ('/' !== $element[0] && ':' !== $element[1]) {
// If not fully qualified
$element .= ' (in ' . getcwd() . ')';
}
xp::error('[bootstrap] Classpath element [' . $element . '] not found');
}
}
isset(self::$delegates[$cl->instanceId()]) || self::registerLoader($cl, $before);
}
}
示例3: xp
};
}
}
// }}}
// {{{ main
error_reporting(E_ALL);
set_error_handler('__error');
date_default_timezone_set(ini_get('date.timezone')) || xp::error('[xp::core] date.timezone not configured properly.');
define('MODIFIER_STATIC', 1);
define('MODIFIER_ABSTRACT', 2);
define('MODIFIER_FINAL', 4);
define('MODIFIER_PUBLIC', 256);
define('MODIFIER_PROTECTED', 512);
define('MODIFIER_PRIVATE', 1024);
xp::$null = new __null();
xp::$loader = new xp();
// Paths are passed via class loader API from *-main.php. Retaining BC:
// Paths are constructed inside an array before including this file.
if (isset($GLOBALS['paths'])) {
xp::$classpath = $GLOBALS['paths'];
} else {
if (0 === strpos(__FILE__, 'xar://')) {
xp::$classpath = [substr(__FILE__, 6, -14)];
} else {
xp::$classpath = [__DIR__ . DIRECTORY_SEPARATOR];
}
}
set_include_path(rtrim(implode(PATH_SEPARATOR, xp::$classpath), PATH_SEPARATOR));
spl_autoload_register(function ($class) {
$name = strtr($class, '\\', '.');
$cl = xp::$loader->findClass($name);
示例4: bootstrap
function bootstrap($classpath)
{
set_include_path($classpath);
xp::$classpath = explode(PATH_SEPARATOR, $classpath);
xp::$loader = new xp();
uses('lang.Object', 'lang.Error', 'lang.XPException', 'lang.XPClass', 'lang.NullPointerException', 'lang.IllegalAccessException', 'lang.IllegalArgumentException', 'lang.IllegalStateException', 'lang.FormatException', 'lang.ClassLoader');
}