diff --git a/System/File/Ftp/FtpStorage.php b/System/File/Ftp/FtpStorage.php index a681391fd..a96821930 100644 --- a/System/File/Ftp/FtpStorage.php +++ b/System/File/Ftp/FtpStorage.php @@ -32,9 +32,19 @@ class FtpStorage extends StorageAbstract { 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 diff --git a/System/File/Local/LocalStorage.php b/System/File/Local/LocalStorage.php index 3cce69807..6604da447 100644 --- a/System/File/Local/LocalStorage.php +++ b/System/File/Local/LocalStorage.php @@ -30,6 +30,21 @@ use phpOMS\System\File\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} */ diff --git a/System/File/StorageAbstract.php b/System/File/StorageAbstract.php index fc6793f66..d1fb38838 100644 --- a/System/File/StorageAbstract.php +++ b/System/File/StorageAbstract.php @@ -28,14 +28,6 @@ namespace phpOMS\System\File; */ abstract class StorageAbstract implements DirectoryInterface, FileInterface { - /** - * Singleton instance. - * - * @var StorageAbstract - * @since 1.0.0 - */ - protected static $instance = null; - /** * Storage type. * @@ -60,15 +52,7 @@ abstract class StorageAbstract implements DirectoryInterface, FileInterface * * @since 1.0.0 */ - public static function getInstance() : StorageAbstract - { - if(!isset(static::$instance)) { - static::$instance = new static(); - } - - return static::$instance; - } - + abstract public static function getInstance() : StorageAbstract; /** * Get storage type. *