Changeset 1214

Show
Ignore:
Timestamp:
01/11/08 14:34:27 (8 months ago)
Author:
mikey
Message:

continued refactoring #119: refactored loading mechanism so that all classes given as foo.bar.Baz are changed to foo::bar::Baz before any checks or loading are performed, this way it will work with star files as soon as we change the package separator in star files to ::

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/main/php/net/stubbles/stubClassLoader.php

    r1209 r1214  
    180180    { 
    181181        $classNames = func_get_args(); 
    182         if (count($classNames) == 0) { 
     182        if (count($classNames) === 0) { 
    183183            // its ok to call this without any arguments, this won't cause any harm 
    184184            return; 
     
    191191        foreach ($classNames as $fqClassName) { 
    192192            $nqClassName = self::getNonQualifiedClassName($fqClassName); 
    193             if (isset(self::$classNames[$nqClassName]) == true) { 
     193            // backward compatibility for dot as package separator 
     194            $fqClassName = str_replace('.', '::', $fqClassName); 
     195            if (isset(self::$classNames[$nqClassName]) === true) { 
    194196                continue; 
    195197            } 
     
    207209            } 
    208210            if (null === $uri) { 
    209                 $uri = self::$sourcePath .  str_replace('::', DIRECTORY_SEPARATOR, str_replace('.', DIRECTORY_SEPARATOR, $fqClassName)) . '.php'; 
    210             } 
    211  
    212             if ((include $uri) == false) { 
     211                $uri = self::$sourcePath .  str_replace('::', DIRECTORY_SEPARATOR, $fqClassName) . '.php'; 
     212            } 
     213 
     214            if ((include_once $uri) === false) { 
    213215                throw new stubClassNotFoundException($fqClassName); 
    214216            } 
    215217 
    216             if (method_exists($nqClassName, '__static') == true) { 
     218            if (method_exists($nqClassName, '__static') === true) { 
    217219                call_user_func(array($nqClassName, '__static')); 
    218220            }