Return an array of file details for a given file.

@param $path

@return array
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),
        ];
    }
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;
    }
91131
public static function findDirs(string $path): array
    {
        $result = [];

        try {
            static::validatePath($path);
            $path = new DirectoryIterator($path);
        } catch (InvalidArgumentException $e) {
            return $result;
        } catch (UnexpectedValueException $e) {
            return $result;
        }

        foreach ($path as $dir) {
            if ($dir->isDot()) {
                continue;
            }
            if (!$dir->isDir()) {
                continue;
            }
            $result[] = $dir->getFilename();
        }
        asort($result);

        return $result;
    }
828155
public function getMigrationFiles($path)
    {
        $files = $this->files->glob($path .'/*_*.php');

        // Once we have the array of files in the directory we will just remove the
        // extension and take the basename of the file which is all we need when
        // finding the migrations that haven't been run against the databases.
        if ($files === false) return array();

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

        }, $files);

        // Once we have all of the formatted file names we will sort them and since
        // they all start with a timestamp this should give us the migrations in
        // the order they were actually created by the application developers.
        sort($files);

        return $files;
    }
1048417
protected function normalizeMetaData($path)
    {
        $meta = $this->client->getObjectMeta($this->bucket, $path);
        if (is_null($meta)) {
            return false;
        }

        return [
            'path'      => $path,
            'timestamp' => strtotime($meta[strtolower('Last-Modified')]),
            'dirname'   => Util::dirname($path),
            'mimetype'  => $meta[strtolower('Content-Type')],
            'size'      => $meta[strtolower('Content-Length')],
            'type'      => 'file',
        ];
    }
710179
protected function _scandir($path) {
		$files = array();
		
		foreach (scandir($path) as $name) {
			if ($name != '.' && $name != '..') {
				$files[] = $path.DIRECTORY_SEPARATOR.$name;
			}
		}
		return $files;
	}
349834
private function ls72(string $path) : array
    {
        $list = [];
        foreach ($this->mlsd($path) as $fileInfo) {
            $list[] = new File($fileInfo);
        }
        return $list;
    }
1270214
public function getFolder($path = '')
    {
        $this->connect();

        $path = trim($path, '/');

        if (file_exists($this->scheme . '/' . $path))
        {

            $result = [ 'folders' => $this->listSubFolder($path), 'files' => $this->listFiles($path) ];

            $folder = new Folder($path, $result);

            return $folder;
        }

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

        return [];
    }
72313
public function dirInfo($file,$path){
        if($file->isReadable()){
            $item = $this->fileDetails;
            $item["filename"] = $file->getFilename();
            $item["filetype"] = $file->getExtension();
            $item["lastmodified"] = $file->getMTime();
            $item["size"] = $file->getSize();
            $item["filetype"] = '';
            $item["isdir"] = true;
            $item["urlfolder"] = $path.$item["filename"].'/';
            $item['preview'] = '';
            return $item;
        }else{
            return ;
        }
    }
942980
public function read($path)
    {
        $location = $this->applyPathPrefix($path);
        return [
            'contents' => $this->ossClient->getObject($this->bucket, $location)
        ];
    }
644556
public function getAttachmentData($path)
    {
        $filesize = filesize($path);
        $handle = fopen($path, "r");
        $attachment = fread($handle, $filesize);
        fclose($handle);
        return $attachment;
    }
836340
protected function byPath($path)
    {
        $pathinfo = pathinfo(strtolower($path));

        if ($pathinfo['dirname'] === '\\') {
            $pathinfo['dirname'] = '/';
        }

        $path = ($pathinfo['dirname'] === '/')
        ? $pathinfo['dirname'] . $pathinfo['filename']
        : $pathinfo['dirname'] . '/' . $pathinfo['filename'];
        $path = $this->normalizePath($path);

        if ($path === '/') {
            $path = '/index';
        }

        $class = [];
        foreach (explode('/', $path) as $word) {
            if ($word) {
                $class[] = $word;
            }
        }
        $class = $this->getConfig('namespace') . implode('\\', array_map('ucfirst', $class));

        return [$class, []];
    }
851009
public function directoryFiles($path)
  {
    $contents = [];

    // Scan directory
    $directoryFiles = scandir($path);

    foreach ($directoryFiles as $index => $filePath)  {

      // Ommit . and ..
      if ( ! in_array($filePath, ['.', '..']))  {

        // Check if this is a directory
        if (is_dir($path . DIRECTORY_SEPARATOR . $filePath)) {

          // Rescan and get files in this directory
          $contents = array_merge($contents, self::directoryFiles($path . DIRECTORY_SEPARATOR . $filePath));

        } else  {

          // Add file to contens array
          $contents[] = $path . DIRECTORY_SEPARATOR . $filePath;
        }
      }
    }

    return $contents;
  }
966357
public function getMetadata(string $path): array
    {
        $parameters = [
            'path' => $this->normalizePath($path),
        ];

        return $this->rpcEndpointRequest('files/get_metadata', $parameters);
    }
206615
public static function get($path)
    {
        $ext = strtolower(pathinfo($path, PATHINFO_EXTENSION));
        if (!isset(self::$fileTypes[$ext])) {
            return false;
        }
        return self::$fileTypes[$ext];
    }
657369
public function loadFromDirectory($path)
    {
        return $this->file->listFiles($path)->mapWithKeys(function ($file, $key) {
            return [$key => $this->loadFile($file)];
        });
    }