Remove useless NewInstance

Bugfix: BodyStructure->SearchCharset return value
This commit is contained in:
djmaze 2020-05-08 11:49:18 +02:00
parent 82e560bc53
commit 693e0f4c10
61 changed files with 802 additions and 1345 deletions

View file

@ -23,7 +23,7 @@ class APC implements \MailSo\Cache\DriverInterface
*/
private $sKeyPrefix;
private function __construct(string $sKeyPrefix = '')
function __construct(string $sKeyPrefix = '')
{
$this->sKeyPrefix = $sKeyPrefix;
if (!empty($this->sKeyPrefix))
@ -33,11 +33,6 @@ class APC implements \MailSo\Cache\DriverInterface
}
}
public static function NewInstance(string $sKeyPrefix = '') : self
{
return new self($sKeyPrefix);
}
public function Set(string $sKey, string $sValue) : bool
{
return \apc_store($this->generateCachedKey($sKey), (string) $sValue);

View file

@ -28,7 +28,7 @@ class File implements \MailSo\Cache\DriverInterface
*/
private $sKeyPrefix;
private function __construct(string $sCacheFolder, string $sKeyPrefix = '')
function __construct(string $sCacheFolder, string $sKeyPrefix = '')
{
$this->sCacheFolder = $sCacheFolder;
$this->sCacheFolder = rtrim(trim($this->sCacheFolder), '\\/').'/';
@ -45,11 +45,6 @@ class File implements \MailSo\Cache\DriverInterface
}
}
public static function NewInstance(string $sCacheFolder, string $sKeyPrefix = '') : self
{
return new self($sCacheFolder, $sKeyPrefix);
}
public function Set(string $sKey, string $sValue) : bool
{
$sPath = $this->generateCachedFileName($sKey, true);

View file

@ -43,13 +43,13 @@ class Memcache implements \MailSo\Cache\DriverInterface
*/
private $sKeyPrefix;
private function __construct(string $sHost = '127.0.0.1', int $iPost = 11211, int $iExpire = 43200, string $sKeyPrefix = '')
function __construct(string $sHost = '127.0.0.1', int $iPost = 11211, int $iExpire = 43200, string $sKeyPrefix = '')
{
$this->sHost = $sHost;
$this->iPost = $iPost;
$this->iExpire = 0 < $iExpire ? $iExpire : 43200;
$this->oMem = new \Memcache();
$this->oMem = new \Memcache;
if (!$this->oMem->connect($this->sHost, $this->iPost))
{
$this->oMem = null;
@ -63,11 +63,6 @@ class Memcache implements \MailSo\Cache\DriverInterface
}
}
public static function NewInstance(string $sHost = '127.0.0.1', int $iPost = 11211, int $iExpire = 43200, string $sKeyPrefix = '') : self
{
return new self($sHost, $iPost, $iExpire, $sKeyPrefix);
}
public function Set(string $sKey, string $sValue) : bool
{
return $this->oMem ? $this->oMem->set($this->generateCachedKey($sKey), $sValue, 0, $this->iExpire) : false;

View file

@ -43,7 +43,7 @@ class Redis implements \MailSo\Cache\DriverInterface
*/
private $sKeyPrefix;
private function __construct(string $sHost = '127.0.0.1', int $iPost = 6379, int $iExpire = 43200, string $sKeyPrefix = '')
function __construct(string $sHost = '127.0.0.1', int $iPost = 6379, int $iExpire = 43200, string $sKeyPrefix = '')
{
$this->sHost = $sHost;
$this->iPost = $iPost;
@ -79,11 +79,6 @@ class Redis implements \MailSo\Cache\DriverInterface
}
}
public static function NewInstance(string $sHost = '127.0.0.1', int $iPost = 6379, int $iExpire = 43200, string $sKeyPrefix = '') : self
{
return new self($sHost, $iPost, $iExpire, $sKeyPrefix);
}
public function Set(string $sKey, string $sValue) : bool
{
return $this->oRedis ? $this->oRedis->setex($this->generateCachedKey($sKey), $this->iExpire, $sValue) : false;