From 217ca52f89d71520b66d0f5eea08303025162000 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Tue, 28 Nov 2017 16:45:13 +0100 Subject: [PATCH] Draft local file/dir object --- System/File/Local/Directory.php | 18 +++++++----------- System/File/Local/File.php | 10 +++++----- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/System/File/Local/Directory.php b/System/File/Local/Directory.php index e506536e6..ad4a328a0 100644 --- a/System/File/Local/Directory.php +++ b/System/File/Local/Directory.php @@ -534,7 +534,7 @@ class Directory extends FileAbstract implements DirectoryInterface */ public function getParent() : ContainerInterface { - // TODO: Implement getParent() method. + return new self(self::parent($this->path)); } /** @@ -542,7 +542,7 @@ class Directory extends FileAbstract implements DirectoryInterface */ public function copyNode(string $to, bool $overwrite = false) : bool { - // TODO: Implement copyNode() method. + return self::copy($this->path, $to, $overwrite); } /** @@ -550,7 +550,7 @@ class Directory extends FileAbstract implements DirectoryInterface */ public function moveNode(string $to, bool $overwrite = false) : bool { - // TODO: Implement moveNode() method. + return self::move($this->path, $to, $overwrite); } /** @@ -558,17 +558,13 @@ class Directory extends FileAbstract implements DirectoryInterface */ public function deleteNode() : bool { - // TODO: Implement deleteNode() method. + return self::delete($this->path); + + // todo: remove from node list } /** - * Offset to retrieve - * @link http://php.net/manual/en/arrayaccess.offsetget.php - * @param mixed $offset

- * The offset to retrieve. - *

- * @return mixed Can return all value types. - * @since 5.0.0 + * {@inheritdoc} */ public function offsetGet($offset) { diff --git a/System/File/Local/File.php b/System/File/Local/File.php index ab42ea946..c2887b6b5 100644 --- a/System/File/Local/File.php +++ b/System/File/Local/File.php @@ -419,7 +419,7 @@ class File extends FileAbstract implements FileInterface */ public function getParent() : ContainerInterface { - // TODO: Implement getParent() method. + return new Directory(self::parent($this->path)); } /** @@ -427,7 +427,7 @@ class File extends FileAbstract implements FileInterface */ public function copyNode(string $to, bool $overwrite = false) : bool { - // TODO: Implement copyNode() method. + return self::copy($this->path, $to, $overwrite); } /** @@ -435,7 +435,7 @@ class File extends FileAbstract implements FileInterface */ public function moveNode(string $to, bool $overwrite = false) : bool { - // TODO: Implement moveNode() method. + return self::move($this->path, $to, $overwrite); } /** @@ -443,7 +443,7 @@ class File extends FileAbstract implements FileInterface */ public function deleteNode() : bool { - // TODO: Implement deleteNode() method. + return self::delete($this->path); } /** @@ -451,7 +451,7 @@ class File extends FileAbstract implements FileInterface */ public function putContent(string $content, int $mode = ContentPutMode::APPEND | ContentPutMode::CREATE) : bool { - // TODO: Implement putContent() method. + return self::put($this->path, $content, $mode); } /**