Fix class functions and namespaces

This commit is contained in:
Dennis Eichhorn 2017-02-25 20:27:19 +01:00
parent 0ce76578e8
commit bbf3e93402
7 changed files with 315 additions and 2 deletions

View File

@ -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 <p>
* The offset to retrieve.
* </p>
* @return mixed Can return all value types.
* @since 5.0.0
*/
public function offsetGet($offset)
{
// TODO: Implement offsetGet() method.
}
}

View File

@ -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 <d.eichhorn@oms.com>
*/
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 <d.eichhorn@oms.com>
*/
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 <d.eichhorn@oms.com>
*/
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 <d.eichhorn@oms.com>
*/
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 <d.eichhorn@oms.com>
*/
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 <d.eichhorn@oms.com>
*/
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 <d.eichhorn@oms.com>
*/
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 <d.eichhorn@oms.com>
*/
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 <d.eichhorn@oms.com>
*/
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 <d.eichhorn@oms.com>
*/
public function getContent() : string
{
// TODO: Implement getContent() method.
}
/**
* Get file extension.
*
* @return string
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function getExtension() : string
{
// TODO: Implement getExtension() method.
}
}

View File

@ -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 = '';

View File

@ -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.