Loads feature files paths from provided path.

@param string $path

@return string[]
352620
private function findFeatureFiles($path)
    {
        $absolutePath = $this->findAbsolutePath($path);

        if (!$absolutePath) {
            return array($path);
        }

        if (is_file($absolutePath)) {
            return array($absolutePath);
        }

        $iterator = new RegexIterator(
            new RecursiveIteratorIterator(
                new RecursiveDirectoryIterator(
                    $absolutePath,
                    RecursiveDirectoryIterator::FOLLOW_SYMLINKS | RecursiveDirectoryIterator::SKIP_DOTS
                )
            ),
            '/^.+\.feature$/i',
            RegexIterator::MATCH
        );

        $paths = array_map('strval', iterator_to_array($iterator));
        uasort($paths, 'strnatcasecmp');

        return $paths;
    }
656641
private function parseFile(string $path): array
    {
        $json = json_decode(file_get_contents($path), true);
        $root = dirname($path);

        $namespaces = array_merge(
            iterator_to_array($this->parseNamespaces($json['autoload']['psr-4'] ?: [], $root)),
            iterator_to_array($this->parseNamespaces($json['autoload-dev']['psr-4'] ?: [], $root))
        );
        return $namespaces;
    }
40818
private function loadFile($path)
    {
        if (file_exists($path)) {
            return $this->loadJsonFile($path);
        }

        $dirs = $this->paths();
        if (empty($dirs)) {
            return null;
        }

        $data = [];
        $dirs = array_reverse($dirs);
        foreach ($dirs as $dir) {
            $file = $dir.DIRECTORY_SEPARATOR.$path;
            if (file_exists($file)) {
                $data = array_replace_recursive($data, $this->loadJsonFile($file));
            }
        }

        if (empty($data)) {
            return null;
        }

        return $data;
    }
1122543
protected function getConfigurationFiles($path)
	{
		$files = [];

		foreach (Finder::create()->files()->name('*.php')->in($path) as $file)
		{
			$files[basename($file->getRealPath(), '.php')] = $file->getRealPath();
		}

		return $files;
	}
640657
protected function getGlobPaths($path)
    {
        $paths = [];
        $iterator = new \GlobIterator($path);

        foreach ($iterator as $fileInfo) {
            /* @var $fileInfo \SplFileInfo */
            $paths[] = $fileInfo->getPathname();
        }

        // validate
        if (count($paths) === 0) {
            throw new InvalidConfigurationException("coverage_clover XML file is not readable: ${path}");
        }

        return $paths;
    }
521873
private function getPathFromArray($path)
    {
        $paths = array();

        foreach ($path as $unverifiedPath) {
            try {
                // Check if `$unverifiedPath` is optional
                // If it exists, then it's added to the list
                // If it doesn't, it throws an exception which we catch
                if ($unverifiedPath[0] !== '?') {
                    $paths = array_merge($paths, $this->getValidPath($unverifiedPath));
                    continue;
                }
                $optionalPath = ltrim($unverifiedPath, '?');
                $paths = array_merge($paths, $this->getValidPath($optionalPath));

            } catch (FileNotFoundException $e) {
                // If `$unverifiedPath` is optional, then skip it
                if ($unverifiedPath[0] === '?') {
                    continue;
                }
                // Otherwise rethrow the exception
                throw $e;
            }
        }

        return $paths;
    }
37530
public function getImportPaths($path = null)
    {
        if ($path === null) {
            return $this->importPaths;
        }

        return isset($this->importPaths[$path])
            ? $this->importPaths[$path]
            : [];
    }
927374
protected function get_files( $path ) {
		$filtered_files = array();
		try {
			$files = new RecursiveIteratorIterator(
				new RecursiveDirectoryIterator(
					$path,
					RecursiveDirectoryIterator::SKIP_DOTS
				),
				RecursiveIteratorIterator::CHILD_FIRST
			);
			foreach ( $files as $file_info ) {
				$pathname = self::normalize_directory_separators( substr( $file_info->getPathname(), strlen( $path ) ) );
				if ( $file_info->isFile() && $this->filter_file( $pathname ) ) {
					$filtered_files[] = $pathname;
				}
			}
		} catch ( Exception $e ) {
			WP_CLI::error( $e->getMessage() );
		}

		return $filtered_files;
	}
1178729
protected function findNewFiles(string $path) : array
    {
        $arrReturn = [];
        $arrFolders = scandir($path);
        $arrSkip = [
            '.',
            '..',
        ];
        
        foreach ($arrFolders as $file) {
            //No Folder Defaults
            if (in_array($file, $arrSkip)) {
                continue;
            }
            //Process Subfolders
            if (is_dir($path.$file)) {
                $arrSubFolderFiles = $this->findNewFiles($path.$file."/");
                $arrReturn = $this->addArrayToNewFiles($arrSubFolderFiles, $arrReturn);
                continue;
            }
            $arrReturn[] = $path.$file;
        }
        
        //Remove file from list if already processed
        foreach($arrReturn as $key => $file) {
            if (in_array($file, $this->knownUpdateFiles)) {
                unset($arrReturn[$key]);
            }
        }
        return $arrReturn;
    }
870516
public function load($path)
	{
		$dir = new \DirectoryIterator(realpath($path));
		foreach ($dir as $fileInfo) {
			if($fileInfo->isFile() && $fileInfo->isReadable() && $fileInfo->getExtension()=='php') {
				$array = include $fileInfo->getPathname();
				$fileName = $fileInfo->getFilename();
				$keyName = substr($fileName, 0, strpos($fileName, '.'));
				$this->commonSettings[$keyName] = $array;
			}
		}
	}
1254856
public static function dirToArr($path): array
    {
        $result = [];
        $dirContent = scandir($path, null);

        foreach ($dirContent as $key => $value) {
            // Exclude system dots folders
            if (!\in_array($value, ['.', '..'])) {
                if (is_dir($path . DIRECTORY_SEPARATOR . $value)) {
                    $result[$value] = self::dirToArr($path . DIRECTORY_SEPARATOR . $value);
                } else {
                    $result[] = $value;
                }
            }
        }

        return $result;
    }
144282
protected function getPathAsArray($path)
    {
        $path = str_replace('\/', '@@@', $path);
        $path = rtrim($path, "/");
        $segments = explode('/', $path);
        return array_map(function($item) {
            return str_replace('@@@', '/', $item);
        }, $segments);
    }
706190
public function loadNode($path) {
        $list = @$this->zookeeper->getChildren($path);
        if(!empty($list)) {
            $data = [];
            foreach($list as $key) {
                $value = $this->zookeeper->get($path . '/' . $key);
                if(!empty($value)) {
                    $data[$key] = $value;
                }else {
                    $data[$key] = $this->loadNode($path . '/' . $key);
                }
            }
            return $data;
        }else {
            $value = @$this->zookeeper->get($path);
            return $value;
        }
    }
740244
private function getFiles($path)
    {
        if (is_file($path)) {
            return [new SplFileInfo($path, '', '')];
        }

        return $this->finder->name('*.php')->in(realpath($path));
    }
988916
private function parseFile($path)
    {
        try {
            $classes = $this->yamlParser->parseFile($path, Yaml::PARSE_CONSTANT);
        } catch (ParseException $e) {
            throw new \InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $path), 0, $e);
        }

        // empty file
        if (null === $classes) {
            return [];
        }

        // not an array
        if (!\is_array($classes)) {
            throw new \InvalidArgumentException(sprintf('The file "%s" must contain a YAML array.', $this->file));
        }

        return $classes;
    }
409700
public function loadFile($path)
    {
        $result = false;

        /*
         * Don't re-include files and stat the file if it exists
         * realpath is needed to resolve symbolic links
         */
        if (!in_array(realpath($path), get_included_files()) && file_exists($path)) {
            $mask = E_ALL ^ E_WARNING;
            if (defined('E_DEPRECATED')) {
                $mask = $mask ^ E_DEPRECATED;
            }

            $old = error_reporting($mask);
            $included = include $path;
            error_reporting($old);

            if ($included) {
                $result = true;
            }
        }

        return $result;
    }
678392
public static function splitNameFromPath($path)
    {
        $name = static::nameFromPath($path);
        $path = static::trimFileName($path);

        return [$path, $name];
    }