Skip to content
This repository has been archived by the owner on Dec 5, 2022. It is now read-only.

Commit

Permalink
[ClassLoader] fixed CS
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Aug 13, 2011
1 parent 040abef commit 33066c1
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions UniversalClassLoader.php
Expand Up @@ -220,13 +220,15 @@ public function findFile($class)
// namespaced class name
$namespace = substr($class, 0, $pos);
foreach ($this->namespaces as $ns => $dirs) {
if (0 === strpos($namespace, $ns)) {
foreach ($dirs as $dir) {
$className = substr($class, $pos + 1);
$file = $dir.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $namespace).DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $className).'.php';
if (file_exists($file)) {
return $file;
}
if (0 !== strpos($namespace, $ns)) {
continue;
}

foreach ($dirs as $dir) {
$className = substr($class, $pos + 1);
$file = $dir.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $namespace).DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $className).'.php';
if (file_exists($file)) {
return $file;
}
}
}
Expand All @@ -240,12 +242,14 @@ public function findFile($class)
} else {
// PEAR-like class name
foreach ($this->prefixes as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
$file = $dir.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $class).'.php';
if (file_exists($file)) {
return $file;
}
if (0 !== strpos($class, $prefix)) {
continue;
}

foreach ($dirs as $dir) {
$file = $dir.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $class).'.php';
if (file_exists($file)) {
return $file;
}
}
}
Expand Down

0 comments on commit 33066c1

Please sign in to comment.