Skip to content

Commit

Permalink
#135 renamed loaded/unloaded properties for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
Ocramius committed Jul 22, 2017
1 parent c60993f commit ee6a30b
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions lib/Doctrine/Common/Annotations/AnnotationRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,24 @@ final class AnnotationRegistry
*
* @var array
*/
static private $loaded = array();
static private $successfullyLoaded = array();

/**
* An array of classes which cannot be found
*
* @var array
*/
static private $unloadable = array();
static private $failedToAutoload = array();

/**
* @return void
*/
static public function reset()
{
self::$autoloadNamespaces = array();
self::$loaders = array();
self::$loaded = array();
self::$unloadable = array();
self::$loaders = array();
self::$successfullyLoaded = array();
self::$failedToAutoload = array();
}

/**
Expand Down Expand Up @@ -127,9 +127,9 @@ static public function registerLoader($callable)
throw new \InvalidArgumentException("A callable is expected in AnnotationRegistry::registerLoader().");
}
// Reset our static cache now that we have a new loader to work with
self::$loaded = array();
self::$unloadable = array();
self::$loaders[] = $callable;
self::$successfullyLoaded = array();
self::$failedToAutoload = array();
self::$loaders[] = $callable;
}

/**
Expand All @@ -141,10 +141,10 @@ static public function registerLoader($callable)
*/
static public function loadAnnotationClass($class)
{
if (isset(self::$loaded[$class])) {
if (isset(self::$successfullyLoaded[$class])) {
return true;
}
if (isset(self::$unloadable[$class])) {
if (isset(self::$failedToAutoload[$class])) {
return false;
}
foreach (self::$autoloadNamespaces AS $namespace => $dirs) {
Expand All @@ -153,14 +153,14 @@ static public function loadAnnotationClass($class)
if ($dirs === null) {
if ($path = stream_resolve_include_path($file)) {
require $path;
self::$loaded[$class] = true;
self::$successfullyLoaded[$class] = true;
return true;
}
} else {
foreach((array)$dirs AS $dir) {
if (is_file($dir . DIRECTORY_SEPARATOR . $file)) {
require $dir . DIRECTORY_SEPARATOR . $file;
self::$loaded[$class] = true;
self::$successfullyLoaded[$class] = true;
return true;
}
}
Expand All @@ -170,11 +170,11 @@ static public function loadAnnotationClass($class)

foreach (self::$loaders AS $loader) {
if (call_user_func($loader, $class) === true) {
self::$loaded[$class] = true;
self::$successfullyLoaded[$class] = true;
return true;
}
}
self::$unloadable[$class] = true;
self::$failedToAutoload[$class] = true;
return false;
}
}

0 comments on commit ee6a30b

Please sign in to comment.