1
0
Fork 0

Optimize grabbing of first char

pull/1871/head
Jordi Boggiano 2013-05-06 10:16:30 +02:00
parent 94175ce432
commit 976fe48a72
1 changed files with 3 additions and 2 deletions

View File

@ -98,7 +98,8 @@ class ClassLoader
return;
}
$first = substr($prefix, 0, 1);
$first = $prefix[0];
if (!isset($this->prefixes[$first][$prefix])) {
$this->prefixes[$first][$prefix] = (array) $paths;
@ -216,7 +217,7 @@ class ClassLoader
$classPath .= strtr($className, '_', DIRECTORY_SEPARATOR) . '.php';
$first = substr($class, 0, 1);
$first = $class[0];
if (isset($this->prefixes[$first])) {
foreach ($this->prefixes[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {