本文整理汇总了PHP中ClassLoader::addClassMap方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassLoader::addClassMap方法的具体用法?PHP ClassLoader::addClassMap怎么用?PHP ClassLoader::addClassMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClassLoader
的用法示例。
在下文中一共展示了ClassLoader::addClassMap方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLoader
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('\\Composer\\Autoload\\Initializer', 'loadClassLoader'), true, true);
self::$loader = $loader = new ClassLoader();
spl_autoload_unregister(array('\\Composer\\Autoload\\Initializer', 'loadClassLoader'));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
$map = (require __DIR__ . '/autoload_namespaces.php');
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$classMap = (require __DIR__ . '/autoload_classmap.php');
if ($classMap) {
$loader->addClassMap($classMap);
}
$loader->register(true);
$includeFiles = (require __DIR__ . '/autoload_files.php');
foreach ($includeFiles as $file) {
require $file;
}
return $loader;
}
示例2: getLoader
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('AutoloaderInit', 'loadClassLoader'), true, true);
self::$loader = $loader = new ClassLoader();
spl_autoload_unregister(array('AutoloaderInit', 'loadClassLoader'));
/* $map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}*/
/* $map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}*/
$includeFiles = (require __DIR__ . '/autoload_files.php');
foreach ($includeFiles as $file) {
composerRequire($file);
}
$classMap = (require __DIR__ . '/autoload_classmap.php');
if ($classMap) {
$loader->addClassMap($classMap);
}
$loader->register(true);
return $loader;
}
示例3: configure
/**
* Add autoload configuration of packages managed by Composer
*
* @param ClassLoader $classLoader class loader instance to configure
* @param string $vendorDirPath path to the vendor directory without trailing slash
*/
public static function configure(ClassLoader $classLoader, $vendorDirPath)
{
$composerBasePath = $vendorDirPath . '/composer/';
$classLoader->addClassMap(include $composerBasePath . 'autoload_classmap.php');
$classLoader->addPrefixes(include $composerBasePath . 'autoload_psr4.php');
$classLoader->addPrefixes(include $composerBasePath . 'autoload_namespaces.php', ClassLoader::PSR0);
foreach (include $composerBasePath . 'autoload_files.php' as $file) {
require $file;
}
}
示例4: getLoader
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoLoaderInit', 'loadClassLoader'), true, true);
self::$loader = $loader = new ClassLoader();
spl_autoload_unregister(array('ComposerAutoLoaderInit', 'loadClassLoader'));
$class_map = (require dirname(__FILE__) . '/autoload_classmap.php');
if ($class_map) {
$loader->addClassMap($class_map);
}
$loader->register();
return $loader;
}
示例5: ClassLoader
static function get_load()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('Composer_load', 'loadClassLoader'), true, true);
self::$loader = $loader = new ClassLoader();
spl_autoload_unregister(array('Composer_load', 'loadClassLoader'));
$map = (require COMPOSERDIR . '/autoload_namespaces.php');
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = (require COMPOSERDIR . '/autoload_psr4.php');
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = (require COMPOSERDIR . '/autoload_classmap.php');
if ($classMap) {
$loader->addClassMap($classMap);
}
$loader->register(true);
return $loader;
}
示例6: addClass
/**
* 添加类文件映射
* @param unknown $name
* @param unknown $file
*/
public function addClass($name, $file)
{
$this->map[$name] = $file;
ClassLoader::addClassMap($this->map, false);
}