mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 17:58:41 +00:00
Fixing implementation differences
This commit is contained in:
parent
6b25cd2df7
commit
2f3b982ca2
|
|
@ -193,6 +193,18 @@ interface ContainerInterface
|
|||
*/
|
||||
public static function basename(string $path) : string;
|
||||
|
||||
/**
|
||||
* Make name/path operating system safe.
|
||||
*
|
||||
* @param string $path Path of the resource
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function sanitize(string $path) : string;
|
||||
|
||||
/**
|
||||
* Get amount of sub-resources.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ interface DirectoryInterface extends ContainerInterface, \Iterator, \ArrayAccess
|
|||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function count(string $path, bool $recursive = false, array $ignore = []) : int;
|
||||
public static function count(string $path, bool $recursive = true, array $ignore = []) : int;
|
||||
|
||||
/**
|
||||
* Get node by name.
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ class Directory extends FileAbstract implements DirectoryInterface
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public static function count(string $path, bool $recursive = true, array $ignore = ['.', '..', 'cgi-bin',
|
||||
'.DS_Store'])
|
||||
'.DS_Store']) : int
|
||||
{
|
||||
$size = 0;
|
||||
$files = scandir($path);
|
||||
|
|
@ -217,7 +217,7 @@ class Directory extends FileAbstract implements DirectoryInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function permission(string $path) : int
|
||||
public static function permission(string $path) : string
|
||||
{
|
||||
// TODO: Implement permission() method.
|
||||
}
|
||||
|
|
@ -246,6 +246,14 @@ class Directory extends FileAbstract implements DirectoryInterface
|
|||
return file_exists($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function sanitize(string $path) : string
|
||||
{
|
||||
return preg_replace('[^\w\s\d\.\-_~,;:\[\]\(\]\/]', '', $path);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
* @link http://orange-management.com
|
||||
*/
|
||||
namespace phpOMS\System\File\Local;
|
||||
|
||||
use phpOMS\System\File\ContainerInterface;
|
||||
use phpOMS\System\File\ContentPutMode;
|
||||
use phpOMS\System\File\FileInterface;
|
||||
|
|
@ -139,6 +140,14 @@ class File extends FileAbstract implements FileInterface
|
|||
return Directory::parent(dirname($path));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function sanitize(string $path) : string
|
||||
{
|
||||
return preg_replace('[^\w\s\d\.\-_~,;:\[\]\(\]]', '', $path);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
@ -196,7 +205,7 @@ class File extends FileAbstract implements FileInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function permission(string $path) : int
|
||||
public static function permission(string $path) : string
|
||||
{
|
||||
if (!file_exists($path)) {
|
||||
throw new PathException($path);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user