mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-14 23:48:40 +00:00
Fix initialization
This commit is contained in:
parent
8edb12543d
commit
542d62973e
|
|
@ -32,9 +32,19 @@ class FtpStorage extends StorageAbstract
|
||||||
{
|
{
|
||||||
private $con = null;
|
private $con = null;
|
||||||
|
|
||||||
public function __construct(string $uri, int $port = 21, bool $mode = true, string $login = null, string $pass = null, bool $ssl = false)
|
private static $instance = null;
|
||||||
|
|
||||||
|
public function __construct() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getInstance() : StorageAbstract
|
||||||
{
|
{
|
||||||
$this->connect($uri, $port = 21, $mode, $login = null, $pass = null, $ssl = false);
|
if(!isset(self::$instance)) {
|
||||||
|
self::$instance = new self();
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function connect(string $uri, int $port = 21, bool $mode = true, string $login = null, string $pass = null, bool $ssl = false) : bool
|
public function connect(string $uri, int $port = 21, bool $mode = true, string $login = null, string $pass = null, bool $ssl = false) : bool
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,21 @@ use phpOMS\System\File\StorageAbstract;
|
||||||
*/
|
*/
|
||||||
class LocalStorage extends StorageAbstract
|
class LocalStorage extends StorageAbstract
|
||||||
{
|
{
|
||||||
|
private static $instance = null;
|
||||||
|
|
||||||
|
public function __construct() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getInstance() : StorageAbstract
|
||||||
|
{
|
||||||
|
if(!isset(self::$instance)) {
|
||||||
|
self::$instance = new self();
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$instance;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -28,14 +28,6 @@ namespace phpOMS\System\File;
|
||||||
*/
|
*/
|
||||||
abstract class StorageAbstract implements DirectoryInterface, FileInterface
|
abstract class StorageAbstract implements DirectoryInterface, FileInterface
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Singleton instance.
|
|
||||||
*
|
|
||||||
* @var StorageAbstract
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
protected static $instance = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Storage type.
|
* Storage type.
|
||||||
*
|
*
|
||||||
|
|
@ -60,15 +52,7 @@ abstract class StorageAbstract implements DirectoryInterface, FileInterface
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public static function getInstance() : StorageAbstract
|
abstract public static function getInstance() : StorageAbstract;
|
||||||
{
|
|
||||||
if(!isset(static::$instance)) {
|
|
||||||
static::$instance = new static();
|
|
||||||
}
|
|
||||||
|
|
||||||
return static::$instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get storage type.
|
* Get storage type.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user