From bbf3e934026a09df653abdb6da6953cfe636e63a Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sat, 25 Feb 2017 20:27:19 +0100 Subject: [PATCH] Fix class functions and namespaces --- System/File/Ftp/Directory.php | 146 +++++++++++++++ System/File/Ftp/File.php | 167 ++++++++++++++++++ .../EDI850.php | 0 .../EDI850Detail.php | 2 +- .../EDI850Heading.php | 2 +- .../EDI850Summary.php | 0 .../TransactionSetHeader.php | 0 7 files changed, 315 insertions(+), 2 deletions(-) rename Utils/EDI/AnsiX12/Purchase/{PurchaseOrder.php => PurchaseOrder}/EDI850.php (100%) rename Utils/EDI/AnsiX12/Purchase/{PurchaseOrder.php => PurchaseOrder}/EDI850Detail.php (98%) rename Utils/EDI/AnsiX12/Purchase/{PurchaseOrder.php => PurchaseOrder}/EDI850Heading.php (94%) rename Utils/EDI/AnsiX12/Purchase/{PurchaseOrder.php => PurchaseOrder}/EDI850Summary.php (100%) rename Utils/EDI/AnsiX12/Purchase/{PurchaseOrder.php => PurchaseOrder}/TransactionSetHeader.php (100%) diff --git a/System/File/Ftp/Directory.php b/System/File/Ftp/Directory.php index 6780f4a50..aa0d550d1 100644 --- a/System/File/Ftp/Directory.php +++ b/System/File/Ftp/Directory.php @@ -21,6 +21,7 @@ use phpOMS\System\File\ContainerInterface; use phpOMS\System\File\DirectoryInterface; use phpOMS\System\File\PathException; use phpOMS\Utils\StringUtils; +use phpOMS\System\File\Local\FileAbstract; use phpOMS\System\File\Local\Directory as DirectoryLocal; /** @@ -158,4 +159,149 @@ class Directory extends FileAbstract implements DirectoryInterface { return DirectoryLocal::basename($path); } + + /** + * {@inheritdoc} + */ + public function getNode(string $name) : FileAbstract + { + return $this->nodes[$name] ?? null; + } + + /** + * {@inheritdoc} + */ + public function createNode() : bool + { + return self::create($this->path, $this->permission, true); + + // todo: add node + } + + public function addNode($file) : bool + { + $this->count += $file->getCount(); + $this->size += $file->getSize(); + $this->nodes[$file->getName()] = $file; + + return $file->createNode(); + } + + /** + * {@inheritdoc} + */ + public function getParent() : ContainerInterface + { + // TODO: Implement getParent() method. + } + + /** + * {@inheritdoc} + */ + public function copyNode(string $to, bool $overwrite = false) : bool + { + // TODO: Implement copyNode() method. + } + + /** + * {@inheritdoc} + */ + public function moveNode(string $to, bool $overwrite = false) : bool + { + // TODO: Implement moveNode() method. + } + + /** + * {@inheritdoc} + */ + public function deleteNode() : bool + { + // TODO: Implement deleteNode() method. + } + + /** + * {@inheritdoc} + */ + public function rewind() + { + reset($this->nodes); + } + + /** + * {@inheritdoc} + */ + public function current() + { + return current($this->nodes); + } + + /** + * {@inheritdoc} + */ + public function key() + { + return key($this->nodes); + } + + /** + * {@inheritdoc} + */ + public function next() + { + return next($this->nodes); + } + + /** + * {@inheritdoc} + */ + public function valid() + { + $key = key($this->nodes); + + return ($key !== null && $key !== false); + } + + /** + * {@inheritdoc} + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->addNode($value); + } else { + $this->nodes[$offset] = $value; + } + } + + /** + * {@inheritdoc} + */ + public function offsetExists($offset) + { + return isset($this->nodes[$offset]); + } + + /** + * {@inheritdoc} + */ + public function offsetUnset($offset) + { + if (isset($this->nodes[$offset])) { + unset($this->nodes[$offset]); + } + } + + /** + * 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 + */ + public function offsetGet($offset) + { + // TODO: Implement offsetGet() method. + } } \ No newline at end of file diff --git a/System/File/Ftp/File.php b/System/File/Ftp/File.php index 76c8281b2..fd4dd9132 100644 --- a/System/File/Ftp/File.php +++ b/System/File/Ftp/File.php @@ -22,6 +22,7 @@ use phpOMS\System\File\ContentPutMode; use phpOMS\System\File\FileInterface; use phpOMS\System\File\PathException; use phpOMS\System\File\Local\File as FileLocal; +use phpOMS\System\File\Local\FileAbstract; use phpOMS\System\File\Local\Directory as DirectoryLocal; /** @@ -330,4 +331,170 @@ class File extends FileAbstract implements FileInterface { return FileLocal::extension($path); } + + /** + * Get the parent path of the resource. + * + * The parent resource path is always a directory. + * + * @return ContainerInterface + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function getParent() : ContainerInterface + { + // TODO: Implement getParent() method. + } + + /** + * Create resource at destination path. + * + * @return bool True on success and false on failure + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function createNode() : bool + { + // TODO: Implement createNode() method. + } + + /** + * Copy resource to different location. + * + * @param string $to Path of the resource to copy to + * @param bool $overwrite Overwrite/replace existing file + * + * @return bool True on success and false on failure + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function copyNode(string $to, bool $overwrite = false) : bool + { + // TODO: Implement copyNode() method. + } + + /** + * Move resource to different location. + * + * @param string $to Path of the resource to move to + * @param bool $overwrite Overwrite/replace existing file + * + * @return bool True on success and false on failure + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function moveNode(string $to, bool $overwrite = false) : bool + { + // TODO: Implement moveNode() method. + } + + /** + * Delete resource at destination path. + * + * @return bool True on success and false on failure + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function deleteNode() : bool + { + // TODO: Implement deleteNode() method. + } + + /** + * Save content to file. + * + * @param string $content Content to save in file + * @param int $mode Mode (overwrite, append) + * + * @return bool + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function putContent(string $content, int $mode = ContentPutMode::APPEND | ContentPutMode::CREATE) : bool + { + // TODO: Implement putContent() method. + } + + /** + * Save content to file. + * + * Creates new file if it doesn't exist or overwrites existing file. + * + * @param string $content Content to save in file + * + * @return bool + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function setContent(string $content) : bool + { + // TODO: Implement setContent() method. + } + + /** + * Save content to file. + * + * Creates new file if it doesn't exist or overwrites existing file. + * + * @param string $content Content to save in file + * + * @return bool + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function appendContent(string $content) : bool + { + // TODO: Implement appendContent() method. + } + + /** + * Save content to file. + * + * Creates new file if it doesn't exist or overwrites existing file. + * + * @param string $content Content to save in file + * + * @return bool + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function prependContent(string $content) : bool + { + // TODO: Implement prependContent() method. + } + + /** + * Get content from file. + * + * @return string Content of file + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function getContent() : string + { + // TODO: Implement getContent() method. + } + + /** + * Get file extension. + * + * @return string + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function getExtension() : string + { + // TODO: Implement getExtension() method. + } } \ No newline at end of file diff --git a/Utils/EDI/AnsiX12/Purchase/PurchaseOrder.php/EDI850.php b/Utils/EDI/AnsiX12/Purchase/PurchaseOrder/EDI850.php similarity index 100% rename from Utils/EDI/AnsiX12/Purchase/PurchaseOrder.php/EDI850.php rename to Utils/EDI/AnsiX12/Purchase/PurchaseOrder/EDI850.php diff --git a/Utils/EDI/AnsiX12/Purchase/PurchaseOrder.php/EDI850Detail.php b/Utils/EDI/AnsiX12/Purchase/PurchaseOrder/EDI850Detail.php similarity index 98% rename from Utils/EDI/AnsiX12/Purchase/PurchaseOrder.php/EDI850Detail.php rename to Utils/EDI/AnsiX12/Purchase/PurchaseOrder/EDI850Detail.php index 0044b1623..4280cb007 100644 --- a/Utils/EDI/AnsiX12/Purchase/PurchaseOrder.php/EDI850Detail.php +++ b/Utils/EDI/AnsiX12/Purchase/PurchaseOrder/EDI850Detail.php @@ -28,7 +28,7 @@ namespace phpOMS\Utils\EDI\AnsiX12\Purchase\PurchaseOrder; * @link http://orange-management.com * @since 1.0.0 */ -class EDI850Heading +class EDI850Detail { private $detailBaselineItemData = ''; diff --git a/Utils/EDI/AnsiX12/Purchase/PurchaseOrder.php/EDI850Heading.php b/Utils/EDI/AnsiX12/Purchase/PurchaseOrder/EDI850Heading.php similarity index 94% rename from Utils/EDI/AnsiX12/Purchase/PurchaseOrder.php/EDI850Heading.php rename to Utils/EDI/AnsiX12/Purchase/PurchaseOrder/EDI850Heading.php index a97ec3beb..bbe6027f6 100644 --- a/Utils/EDI/AnsiX12/Purchase/PurchaseOrder.php/EDI850Heading.php +++ b/Utils/EDI/AnsiX12/Purchase/PurchaseOrder/EDI850Heading.php @@ -15,7 +15,7 @@ */ declare(strict_types=1); -namespace phpOMS\Utils\EDI\AnsiX12\Purchase\PurchaseOrder; +namespace phpOMS\Utils\EDI\AnsiX12\Purchase; /** * EDI 850 - Purchase order. diff --git a/Utils/EDI/AnsiX12/Purchase/PurchaseOrder.php/EDI850Summary.php b/Utils/EDI/AnsiX12/Purchase/PurchaseOrder/EDI850Summary.php similarity index 100% rename from Utils/EDI/AnsiX12/Purchase/PurchaseOrder.php/EDI850Summary.php rename to Utils/EDI/AnsiX12/Purchase/PurchaseOrder/EDI850Summary.php diff --git a/Utils/EDI/AnsiX12/Purchase/PurchaseOrder.php/TransactionSetHeader.php b/Utils/EDI/AnsiX12/Purchase/PurchaseOrder/TransactionSetHeader.php similarity index 100% rename from Utils/EDI/AnsiX12/Purchase/PurchaseOrder.php/TransactionSetHeader.php rename to Utils/EDI/AnsiX12/Purchase/PurchaseOrder/TransactionSetHeader.php