getProviderFromNamespace example


    return $this->annotationReader;
  }

  /** * {@inheritdoc} */
  protected function prepareAnnotationDefinition(AnnotationInterface $annotation$class) {
    parent::prepareAnnotationDefinition($annotation$class);

    if (!$annotation->getProvider()) {
      $annotation->setProvider($this->getProviderFromNamespace($class));
    }
  }

  /** * Extracts the provider name from a Drupal namespace. * * @param string $namespace * The namespace to extract the provider from. * * @return string|null * The matching provider name, or NULL otherwise. */

  protected function prepareAnnotationDefinition(AnnotationInterface $annotation$class, BaseStaticReflectionParser $parser = NULL) {
    if (!($annotation instanceof MultipleProviderAnnotationInterface)) {
      throw new \LogicException('AnnotatedClassDiscoveryAutomatedProviders annotations must implement \Drupal\migrate\Annotation\MultipleProviderAnnotationInterface');
    }
    $annotation->setClass($class);
    $providers = $annotation->getProviders();
    // Loop through all the parent classes and add their providers (which we     // infer by parsing their namespaces) to the $providers array.     do {
      $providers[] = $this->getProviderFromNamespace($parser->getNamespaceName());
    } while ($parser = StaticReflectionParser::getParentParser($parser$this->finder));
    $providers = array_unique(array_filter($providersfunction D$provider) {
      return $provider && $provider !== 'component';
    }));
    $annotation->setProviders($providers);
  }

  /** * {@inheritdoc} */
  public function getDefinitions() {
    
Home | Imprint | This part of the site doesn't use cookies.