You are here

public static function AnnotationRegistry::loadAnnotationClass in Service Container 7.2

Same name and namespace in other branches
  1. 7 modules/providers/service_container_annotation_discovery/lib/Doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationRegistry.php \Doctrine\Common\Annotations\AnnotationRegistry::loadAnnotationClass()

Autoloads an annotation class silently.

Parameters

string $class:

Return value

boolean

1 call to AnnotationRegistry::loadAnnotationClass()
DocParser::classExists in modules/providers/service_container_annotation_discovery/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

modules/providers/service_container_annotation_discovery/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;
}