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

@ -82,7 +82,7 @@ abstract class Driver
*/
private $aCache;
protected function __construct()
function __construct()
{
$this->sDatePattern = 'H:i:s';
$this->sName = 'INFO';

View file

@ -32,7 +32,7 @@ class Callback extends \MailSo\Log\Driver
* @param mixed $fWriteCallback
* @param mixed $fClearCallback
*/
protected function __construct($fWriteCallback, $fClearCallback)
function __construct($fWriteCallback, $fClearCallback)
{
parent::__construct();
@ -40,15 +40,6 @@ class Callback extends \MailSo\Log\Driver
$this->fClearCallback = \is_callable($fClearCallback) ? $fClearCallback : null;
}
/**
* @param mixed $fWriteCallback
* @param mixed $fClearCallback = null
*/
public static function NewInstance($fWriteCallback, $fClearCallback = null) : \MailSo\Log\Drivers\Callback
{
return new self($fWriteCallback, $fClearCallback);
}
protected function writeImplementation($mDesc) : bool
{
if ($this->fWriteCallback)

View file

@ -23,7 +23,7 @@ class File extends \MailSo\Log\Driver
*/
private $sLoggerFileName;
protected function __construct(string $sLoggerFileName, string $sNewLine = "\r\n")
function __construct(string $sLoggerFileName, string $sNewLine = "\r\n")
{
parent::__construct();
@ -36,11 +36,6 @@ class File extends \MailSo\Log\Driver
$this->sLoggerFileName = $sLoggerFileName;
}
public static function NewInstance(string $sLoggerFileName, string $sNewLine = "\r\n") : \MailSo\Log\Drivers\File
{
return new self($sLoggerFileName, $sNewLine);
}
protected function writeImplementation($mDesc) : bool
{
return $this->writeToLogFile($mDesc);

View file

@ -23,7 +23,7 @@ class Inline extends \MailSo\Log\Driver
*/
private $bHtmlEncodeSpecialChars;
protected function __construct(string $sNewLine = "\r\n", bool $bHtmlEncodeSpecialChars = false)
function __construct(string $sNewLine = "\r\n", bool $bHtmlEncodeSpecialChars = false)
{
parent::__construct();
@ -31,11 +31,6 @@ class Inline extends \MailSo\Log\Driver
$this->bHtmlEncodeSpecialChars = $bHtmlEncodeSpecialChars;
}
public static function NewInstance(string $sNewLine = "\r\n", bool $bHtmlEncodeSpecialChars = false) : \MailSo\Log\Drivers\Inline
{
return new self($sNewLine, $bHtmlEncodeSpecialChars);
}
protected function writeImplementation($mDesc) : bool
{
if (\is_array($mDesc))

View file

@ -20,7 +20,7 @@ class Syslog extends \MailSo\Log\Driver
{
private $iLogLevel;
protected function __construct()
function __construct()
{
parent::__construct();
@ -40,11 +40,6 @@ class Syslog extends \MailSo\Log\Driver
}
}
public static function NewInstance() : \MailSo\Log\Drivers\Syslog
{
return new self();
}
protected function writeImplementation($mDesc) : bool
{
if (null === $this->iLogLevel)

View file

@ -42,7 +42,7 @@ class Logger extends \MailSo\Base\Collection
*/
private $bHideErrorNotices;
protected function __construct(bool $bRegPhpErrorHandler = true)
function __construct(bool $bRegPhpErrorHandler = true)
{
parent::__construct();
@ -60,11 +60,6 @@ class Logger extends \MailSo\Base\Collection
\register_shutdown_function(array(&$this, '__loggerShutDown'));
}
public static function NewInstance(bool $bRegPhpErrorHandler = false) : self
{
return new self($bRegPhpErrorHandler);
}
/**
* @staticvar \MailSo\Log\Logger $oInstance;
*/
@ -73,7 +68,7 @@ class Logger extends \MailSo\Base\Collection
static $oInstance = null;
if (null === $oInstance)
{
$oInstance = self::NewInstance();
$oInstance = new self;
}
return $oInstance;