- /**
- * Retrieves list of classes for given path
- *
- * @param string $path
- * @return array
- * @throws FileSystemException
- * @SuppressWarnings(PHPMD.CyclomaticComplexity)
- */
- public function getList($path)
- {
-
- $realPath = realpath($path);
- $isGeneration = strpos($realPath, $this->generationDirectory) === 0;
-
- // Generation folders should not have their results cached since they may actually change during compile
- if (!$isGeneration && isset($this->fileResults[$realPath])) {
- return $this->fileResults[$realPath];
- }
- if (!(bool)$realPath) {
- throw new FileSystemException(new \Magento\Framework\Phrase('Invalid path: %1', [$path]));
- }
- $recursiveIterator = new \RecursiveIteratorIterator(
- new \RecursiveDirectoryIterator($realPath, \FilesystemIterator::FOLLOW_SYMLINKS),
- \RecursiveIteratorIterator::SELF_FIRST
- );
-
- $classes = $this->extract($recursiveIterator);
- if (!$isGeneration) {
- $this->fileResults[$realPath] = $classes;
- }
- return $classes;
- }