mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-09 17:37:02 +03:00
More params and returns to PHP 7.3+
This commit is contained in:
parent
3d246ae842
commit
26c38b3ec9
95 changed files with 1028 additions and 4865 deletions
|
|
@ -82,9 +82,6 @@ abstract class Driver
|
|||
*/
|
||||
private $aCache;
|
||||
|
||||
/**
|
||||
* @access protected
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
$this->sDatePattern = 'H:i:s';
|
||||
|
|
@ -119,63 +116,37 @@ abstract class Driver
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sTimeOffset
|
||||
*
|
||||
* @return \MailSo\Log\Driver
|
||||
*/
|
||||
public function SetTimeOffset($sTimeOffset)
|
||||
public function SetTimeOffset(string $sTimeOffset) : self
|
||||
{
|
||||
$this->sTimeOffset = (string) $sTimeOffset;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \MailSo\Log\Driver
|
||||
*/
|
||||
public function DisableGuidPrefix()
|
||||
public function DisableGuidPrefix() : self
|
||||
{
|
||||
$this->bGuidPrefix = false;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \MailSo\Log\Driver
|
||||
*/
|
||||
public function DisableTimePrefix()
|
||||
public function DisableTimePrefix() : self
|
||||
{
|
||||
$this->bTimePrefix = false;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $bValue
|
||||
*
|
||||
* @return \MailSo\Log\Driver
|
||||
*/
|
||||
public function WriteOnErrorOnly($bValue)
|
||||
public function WriteOnErrorOnly(bool $bValue) : self
|
||||
{
|
||||
$this->bWriteOnErrorOnly = !!$bValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $bValue
|
||||
*
|
||||
* @return \MailSo\Log\Driver
|
||||
*/
|
||||
public function WriteOnPhpErrorOnly($bValue)
|
||||
public function WriteOnPhpErrorOnly(bool $bValue) : self
|
||||
{
|
||||
$this->bWriteOnPhpErrorOnly = !!$bValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $iTimeout
|
||||
*
|
||||
* @return \MailSo\Log\Driver
|
||||
*/
|
||||
public function WriteOnTimeoutOnly($iTimeout)
|
||||
public function WriteOnTimeoutOnly(int $iTimeout) : self
|
||||
{
|
||||
$this->iWriteOnTimeoutOnly = (int) $iTimeout;
|
||||
if (0 > $this->iWriteOnTimeoutOnly)
|
||||
|
|
@ -186,39 +157,21 @@ abstract class Driver
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \MailSo\Log\Driver
|
||||
*/
|
||||
public function DisableTypedPrefix()
|
||||
public function DisableTypedPrefix() : self
|
||||
{
|
||||
$this->bTypedPrefix = false;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|array $mDesc
|
||||
* @return bool
|
||||
*/
|
||||
abstract protected function writeImplementation($mDesc);
|
||||
abstract protected function writeImplementation($mDesc) : bool;
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function writeEmptyLineImplementation()
|
||||
protected function writeEmptyLineImplementation() : bool
|
||||
{
|
||||
return $this->writeImplementation('');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sTimePrefix
|
||||
* @param string $sDesc
|
||||
* @param int $iType = \MailSo\Log\Enumerations\Type::INFO
|
||||
* @param array $sName = ''
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function loggerLineImplementation($sTimePrefix, $sDesc,
|
||||
$iType = \MailSo\Log\Enumerations\Type::INFO, $sName = '')
|
||||
protected function loggerLineImplementation(string $sTimePrefix, string $sDesc,
|
||||
int $iType = \MailSo\Log\Enumerations\Type::INFO, string $sName = '') : string
|
||||
{
|
||||
return \ltrim(
|
||||
($this->bTimePrefix ? '['.$sTimePrefix.']' : '').
|
||||
|
|
@ -227,43 +180,25 @@ abstract class Driver
|
|||
).$sDesc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function clearImplementation()
|
||||
protected function clearImplementation() : bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function getTimeWithMicroSec()
|
||||
protected function getTimeWithMicroSec() : string
|
||||
{
|
||||
$aMicroTimeItems = \explode(' ', \microtime());
|
||||
return \MailSo\Log\Logger::DateHelper($this->sDatePattern, $this->sTimeOffset, $aMicroTimeItems[1]).'.'.
|
||||
\str_pad((int) ($aMicroTimeItems[0] * 1000), 3, '0', STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $iType
|
||||
* @param string $sName = ''
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getTypedPrefix($iType, $sName = '')
|
||||
protected function getTypedPrefix(int $iType, string $sName = '') : string
|
||||
{
|
||||
$sName = 0 < \strlen($sName) ? $sName : $this->sName;
|
||||
return isset($this->aPrefixes[$iType]) ? $sName.$this->aPrefixes[$iType].': ' : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|array $mDesc
|
||||
* @param bool $bDiplayCrLf = false
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function localWriteImplementation($mDesc, $bDiplayCrLf = false)
|
||||
protected function localWriteImplementation($mDesc, bool $bDiplayCrLf = false) : string
|
||||
{
|
||||
if ($bDiplayCrLf)
|
||||
{
|
||||
|
|
@ -285,15 +220,6 @@ abstract class Driver
|
|||
return $this->writeImplementation($mDesc);
|
||||
}
|
||||
|
||||
/**
|
||||
* @final
|
||||
* @param string $sDesc
|
||||
* @param int $iType = \MailSo\Log\Enumerations\Type::INFO
|
||||
* @param string $sName = ''
|
||||
* @param bool $bDiplayCrLf = false
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
final public function Write($sDesc, $iType = \MailSo\Log\Enumerations\Type::INFO, $sName = '', $bDiplayCrLf = false)
|
||||
{
|
||||
$bResult = true;
|
||||
|
|
@ -339,9 +265,9 @@ abstract class Driver
|
|||
$bResult = $this->localWriteImplementation($this->aCache, $bDiplayCrLf);
|
||||
$this->aCache = array();
|
||||
}
|
||||
else if (0 < $this->iWriteOnTimeoutOnly && \time() - APP_START_TIME > $this->iWriteOnTimeoutOnly)
|
||||
else if (0 < $this->iWriteOnTimeoutOnly && \time() - $_SERVER['REQUEST_TIME_FLOAT'] > $this->iWriteOnTimeoutOnly)
|
||||
{
|
||||
$sFlush = '--- FlushLogCache: WriteOnTimeoutOnly ['.(\time() - APP_START_TIME).'sec]';
|
||||
$sFlush = '--- FlushLogCache: WriteOnTimeoutOnly ['.(\time() - $_SERVER['REQUEST_TIME_FLOAT']).'sec]';
|
||||
if (isset($this->aCache[0]) && empty($this->aCache[0]))
|
||||
{
|
||||
$this->aCache[0] = $sFlush;
|
||||
|
|
@ -373,26 +299,16 @@ abstract class Driver
|
|||
return $bResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function GetNewLine()
|
||||
public function GetNewLine() : string
|
||||
{
|
||||
return $this->sNewLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* @final
|
||||
* @return bool
|
||||
*/
|
||||
final public function Clear()
|
||||
final public function Clear() : bool
|
||||
{
|
||||
return $this->clearImplementation();
|
||||
}
|
||||
|
||||
/**
|
||||
* @final
|
||||
*/
|
||||
final public function WriteEmptyLine() : void
|
||||
{
|
||||
if (!$this->bFlushCache && ($this->bWriteOnErrorOnly || $this->bWriteOnPhpErrorOnly || 0 < $this->iWriteOnTimeoutOnly))
|
||||
|
|
|
|||
|
|
@ -29,8 +29,6 @@ class Callback extends \MailSo\Log\Driver
|
|||
private $fClearCallback;
|
||||
|
||||
/**
|
||||
* @access protected
|
||||
*
|
||||
* @param mixed $fWriteCallback
|
||||
* @param mixed $fClearCallback
|
||||
*/
|
||||
|
|
@ -45,20 +43,13 @@ class Callback extends \MailSo\Log\Driver
|
|||
/**
|
||||
* @param mixed $fWriteCallback
|
||||
* @param mixed $fClearCallback = null
|
||||
*
|
||||
* @return \MailSo\Log\Drivers\Callback
|
||||
*/
|
||||
public static function NewInstance($fWriteCallback, $fClearCallback = null)
|
||||
public static function NewInstance($fWriteCallback, $fClearCallback = null) : \MailSo\Log\Drivers\Callback
|
||||
{
|
||||
return new self($fWriteCallback, $fClearCallback);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|array $mDesc
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function writeImplementation($mDesc)
|
||||
protected function writeImplementation($mDesc) : bool
|
||||
{
|
||||
if ($this->fWriteCallback)
|
||||
{
|
||||
|
|
@ -68,10 +59,7 @@ class Callback extends \MailSo\Log\Driver
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function clearImplementation()
|
||||
protected function clearImplementation() : bool
|
||||
{
|
||||
if ($this->fClearCallback)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,12 +23,6 @@ class File extends \MailSo\Log\Driver
|
|||
*/
|
||||
private $sLoggerFileName;
|
||||
|
||||
/**
|
||||
* @access protected
|
||||
*
|
||||
* @param string $sLoggerFileName
|
||||
* @param string $sNewLine = "\r\n"
|
||||
*/
|
||||
protected function __construct($sLoggerFileName, $sNewLine = "\r\n")
|
||||
{
|
||||
parent::__construct();
|
||||
|
|
@ -37,49 +31,27 @@ class File extends \MailSo\Log\Driver
|
|||
$this->sNewLine = $sNewLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sLoggerFileName
|
||||
*/
|
||||
public function SetLoggerFileName($sLoggerFileName)
|
||||
public function SetLoggerFileName(string $sLoggerFileName)
|
||||
{
|
||||
$this->sLoggerFileName = $sLoggerFileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sLoggerFileName
|
||||
* @param string $sNewLine = "\r\n"
|
||||
*
|
||||
* @return \MailSo\Log\Drivers\File
|
||||
*/
|
||||
public static function NewInstance($sLoggerFileName, $sNewLine = "\r\n")
|
||||
public static function NewInstance(string $sLoggerFileName, string $sNewLine = "\r\n") : \MailSo\Log\Drivers\File
|
||||
{
|
||||
return new self($sLoggerFileName, $sNewLine);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|array $mDesc
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function writeImplementation($mDesc)
|
||||
protected function writeImplementation($mDesc) : bool
|
||||
{
|
||||
return $this->writeToLogFile($mDesc);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function clearImplementation()
|
||||
protected function clearImplementation() : bool
|
||||
{
|
||||
return \unlink($this->sLoggerFileName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|array $mDesc
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function writeToLogFile($mDesc)
|
||||
private function writeToLogFile($mDesc) : bool
|
||||
{
|
||||
if (\is_array($mDesc))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,12 +23,6 @@ class Inline extends \MailSo\Log\Driver
|
|||
*/
|
||||
private $bHtmlEncodeSpecialChars;
|
||||
|
||||
/**
|
||||
* @access protected
|
||||
*
|
||||
* @param string $sNewLine = "\r\n"
|
||||
* @param bool $bHtmlEncodeSpecialChars = false
|
||||
*/
|
||||
protected function __construct($sNewLine = "\r\n", $bHtmlEncodeSpecialChars = false)
|
||||
{
|
||||
parent::__construct();
|
||||
|
|
@ -37,23 +31,12 @@ class Inline extends \MailSo\Log\Driver
|
|||
$this->bHtmlEncodeSpecialChars = $bHtmlEncodeSpecialChars;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sNewLine = "\r\n"
|
||||
* @param bool $bHtmlEncodeSpecialChars = false
|
||||
*
|
||||
* @return \MailSo\Log\Drivers\Inline
|
||||
*/
|
||||
public static function NewInstance($sNewLine = "\r\n", $bHtmlEncodeSpecialChars = false)
|
||||
public static function NewInstance(string $sNewLine = "\r\n", bool $bHtmlEncodeSpecialChars = false) : \MailSo\Log\Drivers\Inline
|
||||
{
|
||||
return new self($sNewLine, $bHtmlEncodeSpecialChars);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $mDesc
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function writeImplementation($mDesc)
|
||||
protected function writeImplementation($mDesc) : bool
|
||||
{
|
||||
if (\is_array($mDesc))
|
||||
{
|
||||
|
|
@ -74,10 +57,7 @@ class Inline extends \MailSo\Log\Driver
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function clearImplementation()
|
||||
protected function clearImplementation() : bool
|
||||
{
|
||||
if (\defined('PHP_SAPI') && 'cli' === PHP_SAPI && \MailSo\Base\Utils::FunctionExistsAndEnabled('system'))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,9 +20,6 @@ class Syslog extends \MailSo\Log\Driver
|
|||
{
|
||||
private $iLogLevel;
|
||||
|
||||
/**
|
||||
* @access protected
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
|
@ -43,20 +40,12 @@ class Syslog extends \MailSo\Log\Driver
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \MailSo\Log\Drivers\Syslog
|
||||
*/
|
||||
public static function NewInstance()
|
||||
public static function NewInstance() : \MailSo\Log\Drivers\Syslog
|
||||
{
|
||||
return new self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|array $mDesc
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function writeImplementation($mDesc)
|
||||
protected function writeImplementation($mDesc) : bool
|
||||
{
|
||||
if (null === $this->iLogLevel)
|
||||
{
|
||||
|
|
@ -71,10 +60,7 @@ class Syslog extends \MailSo\Log\Driver
|
|||
return \syslog($this->iLogLevel, $mDesc);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function clearImplementation()
|
||||
protected function clearImplementation() : bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,11 +42,6 @@ class Logger extends \MailSo\Base\Collection
|
|||
*/
|
||||
private $bHideErrorNotices;
|
||||
|
||||
/**
|
||||
* @access protected
|
||||
*
|
||||
* @param bool $bRegPhpErrorHandler = false
|
||||
*/
|
||||
protected function __construct($bRegPhpErrorHandler = true)
|
||||
{
|
||||
parent::__construct();
|
||||
|
|
@ -65,22 +60,15 @@ class Logger extends \MailSo\Base\Collection
|
|||
\register_shutdown_function(array(&$this, '__loggerShutDown'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $bRegPhpErrorHandler = false
|
||||
*
|
||||
* @return \MailSo\Log\Logger
|
||||
*/
|
||||
public static function NewInstance($bRegPhpErrorHandler = false)
|
||||
public static function NewInstance(bool $bRegPhpErrorHandler = false) : self
|
||||
{
|
||||
return new self($bRegPhpErrorHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
* @staticvar \MailSo\Log\Logger $oInstance;
|
||||
*
|
||||
* @return \MailSo\Log\Logger
|
||||
*/
|
||||
public static function SingletonInstance()
|
||||
public static function SingletonInstance() : self
|
||||
{
|
||||
static $oInstance = null;
|
||||
if (null === $oInstance)
|
||||
|
|
@ -91,34 +79,23 @@ class Logger extends \MailSo\Base\Collection
|
|||
return $oInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sFormat
|
||||
* @param string $sTimeOffset = '0'
|
||||
* @param int $iTimestamp = 0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function DateHelper($sFormat, $sTimeOffset = '0', $iTimestamp = null)
|
||||
public static function DateHelper(string $sFormat, string $sTimeOffset = '0', int $iTimestamp = null) : string
|
||||
{
|
||||
$iTimestamp = null === $iTimestamp ? \time() : (int) $iTimestamp;
|
||||
return \gmdate($sFormat, $iTimestamp + \MailSo\Base\DateTimeHelper::TimeToSec((string) $sTimeOffset));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public static function IsSystemEnabled()
|
||||
public static function IsSystemEnabled() : bool
|
||||
{
|
||||
return !!(\MailSo\Config::$SystemLogger instanceof \MailSo\Log\Logger);
|
||||
return !!(\MailSo\Config::$SystemLogger instanceof Logger);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $mData
|
||||
* @param int $iType = \MailSo\Log\Enumerations\Type::INFO
|
||||
*/
|
||||
public static function SystemLog($mData, $iType = \MailSo\Log\Enumerations\Type::INFO)
|
||||
public static function SystemLog($mData, int $iType = \MailSo\Log\Enumerations\Type::INFO)
|
||||
{
|
||||
if (\MailSo\Config::$SystemLogger instanceof \MailSo\Log\Logger)
|
||||
if (\MailSo\Config::$SystemLogger instanceof Logger)
|
||||
{
|
||||
\MailSo\Config::$SystemLogger->WriteMixed($mData, $iType);
|
||||
}
|
||||
|
|
@ -126,10 +103,8 @@ class Logger extends \MailSo\Base\Collection
|
|||
|
||||
/**
|
||||
* @staticvar string $sCache;
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function Guid()
|
||||
public static function Guid() : string
|
||||
{
|
||||
static $sCache = null;
|
||||
if (null === $sCache)
|
||||
|
|
@ -140,28 +115,17 @@ class Logger extends \MailSo\Base\Collection
|
|||
return $sCache;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function Ping()
|
||||
public function Ping() : bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function IsEnabled()
|
||||
public function IsEnabled() : bool
|
||||
{
|
||||
return 0 < $this->Count();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sWord
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function AddSecret($sWord)
|
||||
public function AddSecret(string $sWord) : bool
|
||||
{
|
||||
if (\is_string($sWord) && 0 < \strlen(\trim($sWord)))
|
||||
{
|
||||
|
|
@ -170,68 +134,37 @@ class Logger extends \MailSo\Base\Collection
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $bShow
|
||||
*
|
||||
* @return \MailSo\Log\Logger
|
||||
*/
|
||||
public function SetShowSecter($bShow)
|
||||
public function SetShowSecter(bool $bShow) : self
|
||||
{
|
||||
$this->bShowSecter = !!$bShow;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $bValue
|
||||
*
|
||||
* @return \MailSo\Log\Logger
|
||||
*/
|
||||
public function HideErrorNotices($bValue)
|
||||
public function HideErrorNotices(bool $bValue) : self
|
||||
{
|
||||
$this->bHideErrorNotices = !!$bValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function IsShowSecter()
|
||||
public function IsShowSecter() : bool
|
||||
{
|
||||
return $this->bShowSecter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $iType
|
||||
*
|
||||
* @return \MailSo\Log\Logger
|
||||
*/
|
||||
public function AddForbiddenType($iType)
|
||||
public function AddForbiddenType(int $iType) : self
|
||||
{
|
||||
$this->aForbiddenTypes[$iType] = true;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $iType
|
||||
*
|
||||
* @return \MailSo\Log\Logger
|
||||
*/
|
||||
public function RemoveForbiddenType($iType)
|
||||
public function RemoveForbiddenType(int $iType) : self
|
||||
{
|
||||
$this->aForbiddenTypes[$iType] = false;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $iErrNo
|
||||
* @param string $sErrStr
|
||||
* @param string $sErrFile
|
||||
* @param int $iErrLine
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function __phpErrorHandler($iErrNo, $sErrStr, $sErrFile, $iErrLine)
|
||||
public function __phpErrorHandler(int $iErrNo, string $sErrStr, string $sErrFile, int $iErrLine) : bool
|
||||
{
|
||||
$iType = \MailSo\Log\Enumerations\Type::NOTICE_PHP;
|
||||
switch ($iErrNo)
|
||||
|
|
@ -271,10 +204,7 @@ class Logger extends \MailSo\Base\Collection
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function WriteEmptyLine()
|
||||
public function WriteEmptyLine() : bool
|
||||
{
|
||||
$iResult = 1;
|
||||
|
||||
|
|
@ -287,17 +217,8 @@ class Logger extends \MailSo\Base\Collection
|
|||
return (bool) $iResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sDesc
|
||||
* @param int $iType = \MailSo\Log\Enumerations\Type::INFO
|
||||
* @param string $sName = ''
|
||||
* @param bool $bSearchSecretWords = true
|
||||
* @param bool $bDiplayCrLf = false
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function Write($sDesc, $iType = \MailSo\Log\Enumerations\Type::INFO,
|
||||
$sName = '', $bSearchSecretWords = true, $bDiplayCrLf = false)
|
||||
public function Write(string $sDesc, int $iType = \MailSo\Log\Enumerations\Type::INFO,
|
||||
string $sName = '', bool $bSearchSecretWords = true, bool $bDiplayCrLf = false) : bool
|
||||
{
|
||||
if (isset($this->aForbiddenTypes[$iType]) && true === $this->aForbiddenTypes[$iType])
|
||||
{
|
||||
|
|
@ -326,32 +247,17 @@ class Logger extends \MailSo\Base\Collection
|
|||
|
||||
/**
|
||||
* @param mixed $oValue
|
||||
* @param int $iType = \MailSo\Log\Enumerations\Type::INFO
|
||||
* @param string $sName = ''
|
||||
* @param bool $bSearchSecretWords = false
|
||||
* @param bool $bDiplayCrLf = false
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function WriteDump($oValue, $iType = \MailSo\Log\Enumerations\Type::INFO, $sName = '',
|
||||
$bSearchSecretWords = false, $bDiplayCrLf = false)
|
||||
public function WriteDump($oValue, int $iType = \MailSo\Log\Enumerations\Type::INFO, string $sName = '',
|
||||
bool $bSearchSecretWords = false, bool $bDiplayCrLf = false) : bool
|
||||
{
|
||||
return $this->Write(\print_r($oValue, true), $iType, $sName, $bSearchSecretWords, $bDiplayCrLf);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Exception $oException
|
||||
* @param int $iType = \MailSo\Log\Enumerations\Type::NOTICE
|
||||
* @param string $sName = ''
|
||||
* @param bool $bSearchSecretWords = true
|
||||
* @param bool $bDiplayCrLf = false
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function WriteException($oException, $iType = \MailSo\Log\Enumerations\Type::NOTICE, $sName = '',
|
||||
$bSearchSecretWords = true, $bDiplayCrLf = false)
|
||||
public function WriteException(\Throwable $oException, int $iType = \MailSo\Log\Enumerations\Type::NOTICE, string $sName = '',
|
||||
bool $bSearchSecretWords = true, bool $bDiplayCrLf = false) : bool
|
||||
{
|
||||
if ($oException instanceof \Exception)
|
||||
if ($oException instanceof \Throwable)
|
||||
{
|
||||
if (isset($oException->__LOGINNED__))
|
||||
{
|
||||
|
|
@ -366,19 +272,10 @@ class Logger extends \MailSo\Base\Collection
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Exception $oException
|
||||
* @param int $iType = \MailSo\Log\Enumerations\Type::NOTICE
|
||||
* @param string $sName = ''
|
||||
* @param bool $bSearchSecretWords = true
|
||||
* @param bool $bDiplayCrLf = false
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function WriteExceptionShort($oException, $iType = \MailSo\Log\Enumerations\Type::NOTICE, $sName = '',
|
||||
$bSearchSecretWords = true, $bDiplayCrLf = false)
|
||||
public function WriteExceptionShort(\Throwable $oException, int $iType = \MailSo\Log\Enumerations\Type::NOTICE, string $sName = '',
|
||||
bool $bSearchSecretWords = true, bool $bDiplayCrLf = false) : bool
|
||||
{
|
||||
if ($oException instanceof \Exception)
|
||||
if ($oException instanceof \Throwable)
|
||||
{
|
||||
if (isset($oException->__LOGINNED__))
|
||||
{
|
||||
|
|
@ -395,20 +292,14 @@ class Logger extends \MailSo\Base\Collection
|
|||
|
||||
/**
|
||||
* @param mixed $mData
|
||||
* @param int $iType = \MailSo\Log\Enumerations\Type::NOTICE
|
||||
* @param string $sName = ''
|
||||
* @param bool $bSearchSecretWords = true
|
||||
* @param bool $bDiplayCrLf = false
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function WriteMixed($mData, $iType = null, $sName = '',
|
||||
$bSearchSecretWords = true, $bDiplayCrLf = false)
|
||||
public function WriteMixed($mData, int $iType = null, string $sName = '',
|
||||
bool $bSearchSecretWords = true, bool $bDiplayCrLf = false) : bool
|
||||
{
|
||||
$iType = null === $iType ? \MailSo\Log\Enumerations\Type::INFO : $iType;
|
||||
if (\is_array($mData) || \is_object($mData))
|
||||
{
|
||||
if ($mData instanceof \Exception)
|
||||
if ($mData instanceof \Throwable)
|
||||
{
|
||||
$iType = null === $iType ? \MailSo\Log\Enumerations\Type::NOTICE : $iType;
|
||||
return $this->WriteException($mData, $iType, $sName, $bSearchSecretWords, $bDiplayCrLf);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue