Get files for a specific path

@param $path
@return array
489926
private function getFiles($path)
    {
        $files = array();

        foreach (new \DirectoryIterator($path) as $file) {
            if ($file->isDot()
                || (null != $this->scriptName && sprintf('%s.php', $this->scriptName) != $file->getFilename())
            ) {
                continue;
            }

            $files[$file->getFilename()] = sprintf('%s/%s', $file->getPath(), $file->getFilename());
        }
        sort($files);

        return $files;
    }
1220375
protected function getPath($path)
    {
        $pathsFile = __DIR__.'/../../../../../config/rinvex.composable.php';
        $paths = file_exists($pathsFile) ? require $pathsFile : [];

        return $paths[$path] ?? __DIR__.$this->paths[$path];
    }
58031
protected function getPath($path)
	{
		$paths = array();

		// If `$path` is an array
		if (is_array($path))
		{
			foreach ($path as $unverifiedPath)
			{
				$paths = array_merge($paths, $this->getPath($unverifiedPath));
			}

			return $paths;
		}

		// If `$path` is a directory
		if (is_dir($path))
		{
			$paths = glob($path . '/*.*');

			return $paths;
		}

		// If `$path` is a file
		if (file_exists($path))
		{
			$paths[] = $path;
		}

		return $paths;
	}
370104
public function get(array $path)
    {
        $current = &$this->hierarchy;
        foreach ($path as $childId) {
            if (!isset($current[$childId])) {
                return [];
            }
            $current = &$current[$childId];
        }

        return $current;
    }
43570
protected function search_folders( $path ) {
		$return       = array();
		$base_folders = array_filter( glob( $this->trailingslashit( $path ) . '*' ), 'is_dir' );

		if ( is_array( $base_folders ) && ! empty( $base_folders ) ) {
			foreach ( $base_folders as $folder ) {
				$_sub = $this->search_folders( $this->untrailingslashit( $folder ) );

				if ( is_array( $_sub ) && ! empty( $_sub ) ) {
					$return = array_merge( $return, $_sub );
				} elseif ( is_string( $_sub ) ) {
					$return = array_merge( $return, array( $_sub ) );
					$return = array_merge( $return, array( $this->untrailingslashit( $path ) ) );
				}
			}
		} else {
			$return = array( $this->trailingslashit( $path ) );
		}

		return $return;
	}
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, ['.', '..']));
    }
833233
public static function getContent($path)
    {
        if (is_dir($path)) {
            $files = array_diff(scandir($path), array('.', '..'));

            return $files;
        } else {
            throw new \Exception(sprintf('Incorrect path "%s" name in %s at line %s', $path, __FILE__, __LINE__));
        }
    }
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);
    }
1060343
protected function get_folders( $path ) {
		if ( isset( $this->subfolders[ $path ] ) ) {
			return $this->subfolders[ $path ];
		}

		$this->subfolders[ $path ] = $this->search_folders( $path );
		return $this->subfolders[ $path ];
	}
1178850
protected function getFiles($path)
    {
        $path = Str::finish($path, '/');

        if (file_exists($path . App::getLocale())) {
            return File::files($path . App::getLocale());
        } elseif (file_exists($path . config('app.fallback_locale'))) {
            return File::files($path . config('app.fallback_locale'));
        }

        return [];
    }
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;
    }
1343618
protected function _getRelDir($path) {
        $filename = basename($path);
        $dir = substr($path, 0, strlen($path) - strlen($filename));
        return $dir;
    }
1132142
protected function loadFile($path) {
        $path = realpath($path);

        if ($this->matchEnvironment($path)) {
            foreach ($this->getDrivers() as $driver) {
                if ($driver->supports($path)) {
                    return $driver->loadFile($path);
                }
            }
        }

        return [];
    }
819925
public function getByPath($path)
    {
        $extension = pathinfo($path, PATHINFO_EXTENSION);
        if ('' === $extension) {
            $extension = null;
        }

        return $this->get($extension);
    }
998544
public function getKeys($path)
    {
        if (empty($path)) {
            return array_keys($this->map->getContainer());
        }
        $value = $this->map[$path];
        if (is_array($value)) {
            return array_keys($value);
        } else {
            return false;
        }

    }
942980
public function read($path)
    {
        $location = $this->applyPathPrefix($path);
        return [
            'contents' => $this->ossClient->getObject($this->bucket, $location)
        ];
    }
120565
protected function getDirs($path, $name)
    {
        $array = [];

        $dirs = array_filter(glob($path . $name), 'is_dir');

        foreach ($dirs as $dir) {
            $array[str_replace($path, '', $dir)] = $path;
        }

        return $array;
    }