/**
  * Constructor.
  *
  * @param string $nsPrefix      The namespace prefix to strip from the class name.
  * @param string $path          The path where mapping documents can be found.
  * @param string $fileExtension File extension which is suffixed on the filename.
  *
  * @throws MappingException When the path does not exist.
  */
 public function __construct($nsPrefix, $path, $fileExtension)
 {
     if (!is_dir($path)) {
         throw MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path);
     }
     $this->nsPrefix = '\\' . trim($nsPrefix, '\\');
     $this->nsPrefixLen = '\\' === $this->nsPrefix ? 0 : strlen($this->nsPrefix);
     $this->fileExtension = $fileExtension;
     $this->path = $path;
 }
 /**
  * Initializes a new FileDriver that looks in the given path(s) for mapping
  * documents and operates in the specified operating mode.
  *
  * @param array  $paths         Paths where mapping documents can be found.
  * @param string $fileExtension File extension which is suffixed on the filename.
  *
  * @throws MappingException When one of the paths does not exist.
  */
 public function __construct(array $paths, $fileExtension)
 {
     $newPaths = [];
     foreach ($paths as $prefix => $path) {
         if (!is_dir($path)) {
             throw MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path);
         }
         $newPaths['\\' . trim($prefix, '\\')] = $path;
     }
     $this->paths = $newPaths;
     $this->fileExtension = $fileExtension;
 }
 /**
  * {@inheritdoc}
  *
  * Borrowed from Doctrine Common AnnotationDriver.
  */
 public function getAllClassNames()
 {
     if ($this->classNames !== null) {
         return $this->classNames;
     }
     if (!$this->paths) {
         return [];
     }
     $classes = [];
     $includedFiles = [];
     foreach ($this->paths as $path) {
         if (!is_dir($path)) {
             throw MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path);
         }
         $iterator = new \RegexIterator(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY), '/^.+\\.php$/i', \RecursiveRegexIterator::GET_MATCH);
         foreach ($iterator as $file) {
             $sourceFile = $file[0];
             if (!preg_match('(^phar:)i', $sourceFile)) {
                 $sourceFile = realpath($sourceFile);
             }
             $current = str_replace('\\', '/', $sourceFile);
             foreach ($this->excludePaths as $excludePath) {
                 $exclude = str_replace('\\', '/', realpath($excludePath));
                 if (strpos($current, $exclude) !== false) {
                     continue 2;
                 }
             }
             require_once $sourceFile;
             $includedFiles[] = $sourceFile;
         }
     }
     $declared = get_declared_classes();
     foreach ($declared as $className) {
         $rc = new \ReflectionClass($className);
         $sourceFile = $rc->getFileName();
         if (in_array($sourceFile, $includedFiles, true) && $this->isTransient($className)) {
             $classes[] = $className;
         }
     }
     $this->classNames = $classes;
     return $classes;
 }