diff --git a/System/File/Ftp/FtpStorage.php b/System/File/Ftp/FtpStorage.php index a96821930..7aad853e1 100644 --- a/System/File/Ftp/FtpStorage.php +++ b/System/File/Ftp/FtpStorage.php @@ -97,7 +97,7 @@ class FtpStorage extends StorageAbstract /** * {@inheritdoc} */ - public static function permission(string $path) : string + public static function permission(string $path) : int { // TODO: Implement permission() method. } @@ -174,6 +174,30 @@ class FtpStorage extends StorageAbstract // TODO: Implement basename() method. } + /** + * {@inheritdoc} + */ + public static function dirname(string $path) : string + { + // TODO: Implement basename() method. + } + + /** + * {@inheritdoc} + */ + public static function dirpath(string $path) : string + { + // TODO: Implement basename() method. + } + + /** + * {@inheritdoc} + */ + public static function list(string $path, string $filter = '*') : array + { + // TODO: Implement basename() method. + } + /** * {@inheritdoc} */ diff --git a/System/File/Local/Directory.php b/System/File/Local/Directory.php index dce7c641d..fbe86c195 100644 --- a/System/File/Local/Directory.php +++ b/System/File/Local/Directory.php @@ -178,11 +178,12 @@ class Directory extends FileAbstract implements DirectoryInterface /** * {@inheritdoc} */ - public static function count(string $path, bool $recursive = true, array $ignore = ['.', '..', 'cgi-bin', - '.DS_Store']) : int + public static function count(string $path, bool $recursive = true, array $ignore = []) : int { $size = 0; $files = scandir($path); + $ignore[] = '.'; + $ignore[] = '..'; foreach ($files as $t) { if (in_array($t, $ignore)) { diff --git a/System/File/Local/File.php b/System/File/Local/File.php index 65f49c4a7..6d966b222 100644 --- a/System/File/Local/File.php +++ b/System/File/Local/File.php @@ -107,7 +107,7 @@ class File extends FileAbstract implements FileInterface /** * {@inheritdoc} */ - public static function count(string $path) : int + public static function count(string $path, bool $recursive = true, array $ignore = []) : int { return 1; } diff --git a/System/File/Local/LocalStorage.php b/System/File/Local/LocalStorage.php index 572685838..4808e0194 100644 --- a/System/File/Local/LocalStorage.php +++ b/System/File/Local/LocalStorage.php @@ -47,7 +47,7 @@ class LocalStorage extends StorageAbstract private static function getClassType(string $path) : string { - return is_dir($path) ? Directory::class : File::class; + return is_dir($path) || (!is_file($path) && stripos($path, '.') === false) ? Directory::class : File::class; } /** @@ -77,7 +77,7 @@ class LocalStorage extends StorageAbstract /** * {@inheritdoc} */ - public static function permission(string $path) : string + public static function permission(string $path) : int { return self::getClassType($path)::permission($path); } @@ -95,7 +95,7 @@ class LocalStorage extends StorageAbstract */ public static function create(string $path) : bool { - return self::getClassType($path)::create($path); + return stripos($path, '.') === false ? Directory::create($path, 0644, true) : File::create($path); } /** @@ -154,6 +154,22 @@ class LocalStorage extends StorageAbstract return self::getClassType($path)::basename($path); } + /** + * {@inheritdoc} + */ + public static function dirname(string $path) : string + { + return self::getClassType($path)::dirname($path); + } + + /** + * {@inheritdoc} + */ + public static function dirpath(string $path) : string + { + return self::getClassType($path)::dirpath($path); + } + /** * {@inheritdoc} */ @@ -189,7 +205,7 @@ class LocalStorage extends StorageAbstract /** * {@inheritdoc} */ - public static function list(string $path, string $filter = '*') : string + public static function list(string $path, string $filter = '*') : array { if(is_file($path)) { throw new \Exception(); @@ -215,7 +231,7 @@ class LocalStorage extends StorageAbstract throw new \Exception(); } - return File::set_socket_blocking($path, $content); + return File::set($path, $content); } /** @@ -251,6 +267,6 @@ class LocalStorage extends StorageAbstract throw new \Exception(); } - return File::extension($path, $content); + return File::extension($path); } } \ No newline at end of file diff --git a/System/File/StorageAbstract.php b/System/File/StorageAbstract.php index b6ae436ec..58dd135cb 100644 --- a/System/File/StorageAbstract.php +++ b/System/File/StorageAbstract.php @@ -86,7 +86,7 @@ abstract class StorageAbstract /** * {@inheritdoc} */ - public abstract static function permission(string $path) : string; + public abstract static function permission(string $path) : int; /** * {@inheritdoc} @@ -133,6 +133,21 @@ abstract class StorageAbstract */ public abstract static function basename(string $path) : string; + /** + * {@inheritdoc} + */ + public abstract static function dirname(string $path) : string; + + /** + * {@inheritdoc} + */ + public abstract static function dirpath(string $path) : string; + + /** + * {@inheritdoc} + */ + public abstract static function list(string $path, string $filter = '*') : array; + /** * {@inheritdoc} */