@param string $path

@return array

@throws \Icicle\File\Exception\FileException
494418
private function lsdir(string $path): array
    {
        $result = @scandir($path);

        if (false === $result) {
            $message = 'Could not read directory.';
            if ($error = error_get_last()) {
                $message .= sprintf(' Errno: %d; %s', $error['type'], $error['message']);
            }
            throw new FileException($message);
        }

        return array_values(array_diff($result, ['.', '..']));
    }
1148879
protected function getFileInfo($path)
    {
        return [
            'name' => substr($path, strrpos($path, '/') + 1),
            'path' => $path,
            'url'  => $this->getFileUrl($path),
        ];
    }
688247
public function read($path) {
			try {
				return ['contents' => $this->bucket->getFileByName($path)->download()];
			} catch (\Exception $e) {
				throw new B2FlysystemException('Error retrieving file', B2FlysystemException::B2_SDK_ERROR, $e);
			}
		}
1241242
private function parsePath(string $path): array
    {
        $pathParts = [];
        foreach (explode('.', $path) as $pathPart) {
            $matches = [];
            if (1 === preg_match('/^(([^\[]+)\[(\d+|_all)\])$/', $pathPart, $matches)) {
                $pathParts[] = $matches[2];
                $pathParts[] = '_all' !== $matches[3] ? (int) $matches[3] : $matches[3];
            } else {
                $pathParts[] = $pathPart;
            }
        }

        return $pathParts;
    }
740244
private function getFiles($path)
    {
        if (is_file($path)) {
            return [new SplFileInfo($path, '', '')];
        }

        return $this->finder->name('*.php')->in(realpath($path));
    }
89111
protected function loadFromFile($path)
    {
        if (!file_exists($path)) {
            throw new \Exception(sprintf('Map file "%s" does not exist.', $path));
        }

        $map = require($path);
        if (!is_array($map)
            || !is_array($map[Settings::ALPHABET_CYR])
            || !is_array($map[Settings::ALPHABET_LAT])
        ) {
            throw new \Exception(sprintf(
                'Map file "%s" is not valid, should return an array with %s and %s subarrays.',
                $path,
                Settings::ALPHABET_CYR,
                Settings::ALPHABET_LAT
            ));
        }

        return $map;
    }
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;
    }
73431
protected function getPhpFiles($path)
    {
        if (is_dir($path)) {
            return new RegexIterator(
                new RecursiveIteratorIterator(
                    new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS),
                    RecursiveIteratorIterator::SELF_FIRST,
                    RecursiveIteratorIterator::CATCH_GET_CHILD // Ignore "Permission denied"
                ),
                '/^.+\.php$/i',
                RecursiveRegexIterator::GET_MATCH
            );
        }
        else {
            return [];
        }
    }
190881
protected function fileDetails($path)
    {
        $path = '/'.ltrim($path, '/');

        return [
            'name'         => basename($path),
            'fullPath'     => $path,
            'webPath'      => $this->fileWebpath($path),
            'mimeType'     => $this->fileMimeType($path),
            'size'         => $this->fileSize($path),
            'modified'     => $this->fileModified($path),
            'relativePath' => $this->fileRelativePath($path),
        ];
    }
315606
protected function getSourceFiles($path)
    {
        $files = [];
        foreach (glob($path.'/*.php') as $file) {
            $files[] = $file;
        }

        return $files;
    }
11365
protected function parsePath(string $path): array
    {
        $parts = explode(DIRECTORY_SEPARATOR, $path);

        $file = array_pop($parts);

        return [
            'root' => implode(DIRECTORY_SEPARATOR, $parts),
            'file' => $file,
        ];
    }
1304951
private function pathinfo(string $path): array
    {
        $pathinfo = pathinfo($path) + compact('path');
        $pathinfo['dirname'] = array_key_exists('dirname', $pathinfo) ?
                            $this->normalizeDirname($pathinfo['dirname']) :
                            '';

        return $pathinfo;
    }
461918
protected function loadPath($path) {
        if (directory_exists($path)) {
            return $this->loadDirectory($path);
        } else if (file_exists($path)) {
            return $this->loadFile($path);
        }

        return [];
    }
72114
public function getFileStats($path)
    {
        $stats = @ssh2_sftp_stat($this->sftp, $path);
        if(!$stats['size']){
            throw new \Exception("Could get file stat: ".$path);
        }
        return $stats;
    }
1085571
public static function getUnusedFiles(array $path): array
    {
        // load thumbnail files
        $thumbFiles = self::getThumbFiles();

        // load path files
        $pathFiles = self::getPathFiles($path);

        return $diff = array_diff($pathFiles, $thumbFiles);
    }
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;
	}
1278746
public function getMappingFiles($path)
    {
        $files = $this->files->glob($path.'/*_*.php');

        if ($files === false) {
            return [];
        }

        $files = array_map(function ($file) {
            return str_replace('.php', '', basename($file));
        }, $files);

        return $files;
    }