Changeset 612

Show
Ignore:
Timestamp:
04/24/07 15:20:42 (1 year ago)
Author:
mikey
Message:

the need for speed: reduced method calls by initializing two static member variables at first execution of load()

Files:

Legend:

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

    r587 r612  
    136136     */ 
    137137    private static $foreignClassLoaders = array(); 
     138    /** 
     139     * switch whether to use star files or not 
     140     * 
     141     * @var  bool 
     142     */ 
     143    private static $useStar             = null; 
     144    /** 
     145     * path to source files 
     146     * 
     147     * @var  string 
     148     */ 
     149    private static $sourcePath          = null; 
    138150 
    139151    /** 
     
    159171        } 
    160172 
     173        if (null == self::$useStar) { 
     174            if (stubConfig::useStar() == true && class_exists('StarClassRegistry', false) == true) { 
     175                self::$useStar = true; 
     176            } else { 
     177                self::$useStar = false; 
     178            } 
     179             
     180            self::$sourcePath = stubConfig::getSourcePath() . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR; 
     181        } 
     182         
    161183        foreach ($classNames as $fqClassName) { 
    162184            $nqClassName = self::getNonQualifiedClassName($fqClassName); 
     
    173195 
    174196            $uri = null; 
    175             if (stubConfig::useStar() == true && class_exists('StarClassRegistry', false) == true) { 
     197            if (true == self::$useStar) { 
    176198                $uri = StarClassRegistry::getUriForClass($fqClassName); 
    177199            } 
    178200            if (null === $uri) { 
    179                 $uri = stubConfig::getSourcePath() . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR .  str_replace('.', DIRECTORY_SEPARATOR, $fqClassName) . '.php'; 
     201                $uri = self::$sourcePath .  str_replace('.', DIRECTORY_SEPARATOR, $fqClassName) . '.php'; 
    180202            } 
    181203