You are here

public static function AnnotationRegistry::loadAnnotationClass in Plug 7

Autoloads an annotation class silently.

Parameters

string $class:

Return value

boolean

1 call to AnnotationRegistry::loadAnnotationClass()
DocParser::classExists in lib/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php
Attempts to check if a class exists or not. This never goes through the PHP autoloading mechanism but uses the {@link AnnotationRegistry} to load classes.

File

lib/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationRegistry.php, line 123

Class

AnnotationRegistry
AnnotationRegistry.

Namespace

Doctrine\Common\Annotations

Code

public static function loadAnnotationClass($class) {
  foreach (self::$autoloadNamespaces as $namespace => $dirs) {
    if (strpos($class, $namespace) === 0) {
      $file = str_replace("\\", DIRECTORY_SEPARATOR, $class) . ".php";
      if ($dirs === null) {
        if ($path = stream_resolve_include_path($file)) {
          require $path;
          return true;
        }
      }
      else {
        foreach ((array) $dirs as $dir) {
          if (is_file($dir . DIRECTORY_SEPARATOR . $file)) {
            require $dir . DIRECTORY_SEPARATOR . $file;
            return true;
          }
        }
      }
    }
  }
  foreach (self::$loaders as $loader) {
    if (call_user_func($loader, $class) === true) {
      return true;
    }
  }
  return false;
}