规范化

This commit is contained in:
thinkphp
2015-12-16 00:06:08 +08:00
parent 80a18db460
commit 2755f8d353

View File

@@ -17,6 +17,11 @@ class Loader
protected static $map = []; protected static $map = [];
// 命名空间 // 命名空间
protected static $namespace = []; protected static $namespace = [];
// PSR-4
private static $prefixLengthsPsr4 = [];
private static $prefixDirsPsr4 = [];
// PSR-0
private static $prefixesPsr0 = [];
// 自动加载 // 自动加载
public static function autoload($class) public static function autoload($class)
@@ -71,13 +76,6 @@ class Loader
spl_autoload_register($autoload ? $autoload : ['think\\loader', 'autoload']); spl_autoload_register($autoload ? $autoload : ['think\\loader', 'autoload']);
} }
// PSR-4
private static $prefixLengthsPsr4 = [];
private static $prefixDirsPsr4 = [];
// PSR-0
private static $prefixesPsr0 = [];
// 注册composer自动加载 // 注册composer自动加载
private static function registerComposerLoader() private static function registerComposerLoader()
{ {
@@ -124,8 +122,8 @@ class Loader
} }
} }
private static function findFileInComposer($class, $ext='.php'){ private static function findFileInComposer($class, $ext = '.php')
{
// PSR-4 lookup // PSR-4 lookup
$logicalPathPsr4 = strtr($class, '\\', DS) . $ext; $logicalPathPsr4 = strtr($class, '\\', DS) . $ext;