コード例 #1
0
 /**
  * Constructs an AnnotatedClassDiscovery object.
  *
  * @param string $subdir
  *   Either the plugin's subdirectory, for example 'Plugin/views/filter', or
  *   empty string if plugins are located at the top level of the namespace.
  * @param \Traversable $root_namespaces
  *   An object that implements \Traversable which contains the root paths
  *   keyed by the corresponding namespace to look for plugin implementations.
  *   If $subdir is not an empty string, it will be appended to each namespace.
  * @param string $plugin_definition_annotation_name
  *   (optional) The name of the annotation that contains the plugin definition.
  *   Defaults to 'Drupal\Component\Annotation\Plugin'.
  */
 function __construct($subdir, \Traversable $root_namespaces, $plugin_definition_annotation_name = 'Drupal\\Component\\Annotation\\Plugin')
 {
     if ($subdir) {
         // Prepend a directory separator to $subdir,
         // if it does not already have one.
         if ('/' !== $subdir[0]) {
             $subdir = '/' . $subdir;
         }
         $this->directorySuffix = $subdir;
         $this->namespaceSuffix = str_replace('/', '\\', $subdir);
     }
     $this->rootNamespacesIterator = $root_namespaces;
     $plugin_namespaces = array();
     parent::__construct($plugin_namespaces, $plugin_definition_annotation_name);
 }