public static function AnnotationRegistry::loadAnnotationClass

Autoload an annotation class silently.

Parameters

string $class:

Return value

boolean

1 call to AnnotationRegistry::loadAnnotationClass()
DocParser::classExists in drupal/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocParser.php
Attempt 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

drupal/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationRegistry.php, line 111

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 (file_exists($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;
}