Implemented more ftp draft functions

This commit is contained in:
Dennis Eichhorn 2017-01-22 21:03:47 +01:00
parent cda77b6a16
commit ae1a364378
2 changed files with 123 additions and 7 deletions

View File

@ -19,6 +19,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\Directory as DirectoryLocal;
/**
* Filesystem class.
@ -35,4 +36,124 @@ use phpOMS\Utils\StringUtils;
*/
class Directory extends FileAbstract implements DirectoryInterface
{
/**
* {@inheritdoc}
*/
public static function size(string $dir, bool $recursive = true) : int
{
}
/**
* {@inheritdoc}
*/
public static function count(string $path, bool $recursive = true, array $ignore = ['.', '..', 'cgi-bin',
'.DS_Store']) : int
{
}
/**
* {@inheritdoc}
*/
public static function delete(string $path) : bool
{
}
/**
* {@inheritdoc}
*/
public static function parent(string $path) : string
{
}
/**
* {@inheritdoc}
* todo: move to fileAbastract since it should be the same for file and directory?
*/
public static function created(string $path) : \DateTime
{
}
/**
* {@inheritdoc}
*/
public static function changed(string $path) : \DateTime
{
// TODO: Implement changed() method.
}
/**
* {@inheritdoc}
*/
public static function owner(string $path) : int
{
// TODO: Implement owner() method.
}
/**
* {@inheritdoc}
*/
public static function permission(string $path) : string
{
// TODO: Implement permission() method.
}
/**
* {@inheritdoc}
*/
public static function copy(string $from, string $to, bool $overwrite = false) : bool
{
// TODO: Implement copy() method.
}
/**
* {@inheritdoc}
*/
public static function move(string $from, string $to, bool $overwrite = false) : bool
{
// TODO: Implement move() method.
}
/**
* {@inheritdoc}
*/
public static function exists(string $path) : bool
{
}
/**
* {@inheritdoc}
*/
public static function sanitize(string $path, string $replace = '') : string
{
return DirectoryLocal::sanitize($path, $replace);
}
/**
* {@inheritdoc}
*/
public static function create(string $path, string $permission = '0644', bool $recursive = false) : bool
{
}
/**
* {@inheritdoc}
*/
public static function name(string $path) : string
{
return DirectoryLocal::name($path);
}
/**
* {@inheritdoc}
*/
public static function basename(string $path) : string
{
return DirectoryLocal::basename($path);
}
}

View File

@ -289,10 +289,6 @@ class Directory extends FileAbstract implements DirectoryInterface
public static function create(string $path, string $permission = '0644', bool $recursive = false) : bool
{
if (!file_exists($path)) {
if(!is_writable($path)) {
return false;
}
mkdir($path, $permission, $recursive);
return true;
@ -397,8 +393,7 @@ class Directory extends FileAbstract implements DirectoryInterface
*/
public static function name(string $path) : string
{
// todo: name doesn' t make sense
// TODO: Implement name() method.
return basename($path);
}
/**
@ -406,7 +401,7 @@ class Directory extends FileAbstract implements DirectoryInterface
*/
public static function basename(string $path) : string
{
// TODO: Implement basename() method.
return basename($path);
}
/**