You are here

protected function AnnotationClassLoader::getGlobals in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/routing/Loader/AnnotationClassLoader.php \Symfony\Component\Routing\Loader\AnnotationClassLoader::getGlobals()
1 call to AnnotationClassLoader::getGlobals()
AnnotationClassLoader::load in vendor/symfony/routing/Loader/AnnotationClassLoader.php
Loads from annotations from a class.

File

vendor/symfony/routing/Loader/AnnotationClassLoader.php, line 209

Class

AnnotationClassLoader
AnnotationClassLoader loads routing information from a PHP class and its methods.

Namespace

Symfony\Component\Routing\Loader

Code

protected function getGlobals(\ReflectionClass $class) {
  $globals = array(
    'path' => '',
    'requirements' => array(),
    'options' => array(),
    'defaults' => array(),
    'schemes' => array(),
    'methods' => array(),
    'host' => '',
    'condition' => '',
  );
  if ($annot = $this->reader
    ->getClassAnnotation($class, $this->routeAnnotationClass)) {

    // for BC reasons
    if (null !== $annot
      ->getPath()) {
      $globals['path'] = $annot
        ->getPath();
    }
    elseif (null !== $annot
      ->getPattern()) {
      $globals['path'] = $annot
        ->getPattern();
    }
    if (null !== $annot
      ->getRequirements()) {
      $globals['requirements'] = $annot
        ->getRequirements();
    }
    if (null !== $annot
      ->getOptions()) {
      $globals['options'] = $annot
        ->getOptions();
    }
    if (null !== $annot
      ->getDefaults()) {
      $globals['defaults'] = $annot
        ->getDefaults();
    }
    if (null !== $annot
      ->getSchemes()) {
      $globals['schemes'] = $annot
        ->getSchemes();
    }
    if (null !== $annot
      ->getMethods()) {
      $globals['methods'] = $annot
        ->getMethods();
    }
    if (null !== $annot
      ->getHost()) {
      $globals['host'] = $annot
        ->getHost();
    }
    if (null !== $annot
      ->getCondition()) {
      $globals['condition'] = $annot
        ->getCondition();
    }
  }
  return $globals;
}