Permalink
Browse files

got an if-condition out of unnecessary loops in Symfony\Component\Cla…

…ssLoader\UniversalClassLoader
  • Loading branch information...
1 parent c00f87a commit 040abef35a0a1fcdb2820d2317c25b6bd7d3b4c8 @Taluu Taluu committed Aug 11, 2011
Showing with 4 additions and 4 deletions.
  1. +4 −4 UniversalClassLoader.php
View
@@ -220,8 +220,8 @@ public function findFile($class)
// namespaced class name
$namespace = substr($class, 0, $pos);
foreach ($this->namespaces as $ns => $dirs) {
- foreach ($dirs as $dir) {
- if (0 === strpos($namespace, $ns)) {
+ 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)) {
@@ -240,8 +240,8 @@ public function findFile($class)
} else {
// PEAR-like class name
foreach ($this->prefixes as $prefix => $dirs) {
- foreach ($dirs as $dir) {
- if (0 === strpos($class, $prefix)) {
+ 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;

0 comments on commit 040abef

Please sign in to comment.