/**
  * Returns all registered InternalAutoloader instances which are doing their
  * jobs
  *
  * @see register()
  * @return Array
  */
 public static function getRegisteredAutoloaders()
 {
     $autoloaders = array();
     foreach (parent::getRegisteredAutoloaders() as $autoloader) {
         if ($autoloader instanceof self) {
             $autoloaders[] = $autoloader;
         }
     }
     return $autoloaders;
 }
Example #2
0
 /**
  * Removes this Autoloader from the stack
  *
  * If this was resposnible for removing any other autoloaders during
  * _normalizeSearchPaths() the other autoloaders is readded again.
  *
  * @see _removeByNormalization()
  * @see _normalizeSearchPaths()
  * @see removeAll()
  * @see $_unregisteredNormalizedAutoloaders
  * @return void
  */
 public function remove()
 {
     parent::remove();
     $autoloaders = self::$_unregisteredNormalizedAutoloaders;
     self::$_unregisteredNormalizedAutoloaders = array();
     foreach ($autoloaders as $autoloader) {
         $autoloader->register();
     }
 }
Example #3
0
 /**
  * Returns the path to the class definition
  * 
  * The class definition must be created with makeClass()
  * or makeClassInNamespace().
  *
  * @param String $class The class name
  *
  * @see makeClass()
  * @see makeClassInNamespace()
  * @return String
  */
 public function getGeneratedClassPath($class)
 {
     $normlizedName = $class;
     AbstractAutoloader::normalizeClass($normlizedName);
     return $this->_generatedClassPaths[$normlizedName];
 }
Example #4
0
 /**
  * Tests removing of class definitions
  *
  * If an Autoloader found a class, the path for the class definition is fetched
  * from the index. If the class definition is removed, the autoloader should
  * fail.
  *
  * @return void
  */
 public function testRemoveClassdefinition()
 {
     $class = uniqid("testclass");
     $index = Autoloader::getRegisteredAutoloader()->getIndex();
     AbstractAutoloader::normalizeClass($class);
     $index->setPath($class, uniqid('/dev/null/'));
     $this->_autoloaderTestHelper->assertNotLoadable($class);
     $this->assertFalse($index->hasPath($class));
 }