Fix initialization

This commit is contained in:
Dennis Eichhorn 2017-09-09 16:24:03 +02:00
parent 8edb12543d
commit 542d62973e
3 changed files with 28 additions and 19 deletions

View File

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

View File

@ -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}
*/

View File

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