mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-04 23:17:02 +03:00
Bugfixes and more conversions to PHP 7
This commit is contained in:
parent
2cada68f41
commit
3a7ec4ecb0
100 changed files with 238 additions and 992 deletions
|
|
@ -33,9 +33,8 @@ abstract class Collection
|
|||
/**
|
||||
* @param mixed $mItem
|
||||
* @param bool $bToTop = false
|
||||
* @return self
|
||||
*/
|
||||
public function Add($mItem, $bToTop = false)
|
||||
public function Add($mItem, $bToTop = false) : self
|
||||
{
|
||||
if ($bToTop)
|
||||
{
|
||||
|
|
@ -51,11 +50,9 @@ abstract class Collection
|
|||
|
||||
/**
|
||||
* @param array $aItems
|
||||
* @return self
|
||||
*
|
||||
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
|
||||
*/
|
||||
public function AddArray($aItems)
|
||||
public function AddArray($aItems) : self
|
||||
{
|
||||
if (!\is_array($aItems))
|
||||
{
|
||||
|
|
@ -70,14 +67,9 @@ abstract class Collection
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return self
|
||||
*/
|
||||
public function Clear()
|
||||
public function Clear() : void
|
||||
{
|
||||
$this->aItems = array();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -88,10 +80,7 @@ abstract class Collection
|
|||
return $this->aItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function Count()
|
||||
public function Count() : int
|
||||
{
|
||||
return \count($this->aItems);
|
||||
}
|
||||
|
|
@ -144,9 +133,8 @@ abstract class Collection
|
|||
|
||||
/**
|
||||
* @param mixed $mCallback
|
||||
* @return void
|
||||
*/
|
||||
public function ForeachList($mCallback)
|
||||
public function ForeachList($mCallback) : void
|
||||
{
|
||||
if (\is_callable($mCallback))
|
||||
{
|
||||
|
|
@ -174,8 +162,6 @@ abstract class Collection
|
|||
|
||||
/**
|
||||
* @param array $aItems
|
||||
* @return self
|
||||
*
|
||||
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
|
||||
*/
|
||||
public function SetAsArray($aItems)
|
||||
|
|
@ -186,7 +172,5 @@ abstract class Collection
|
|||
}
|
||||
|
||||
$this->aItems = $aItems;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,12 +18,7 @@ namespace MailSo\Base\Exceptions;
|
|||
*/
|
||||
class Exception extends \Exception
|
||||
{
|
||||
/**
|
||||
* @param string $sMessage
|
||||
* @param int $iCode
|
||||
* @param \Exception|null $oPrevious
|
||||
*/
|
||||
public function __construct($sMessage = '', $iCode = 0, $oPrevious = null)
|
||||
public function __construct(string $sMessage = '', int $iCode = 0, \Throwable $oPrevious = null)
|
||||
{
|
||||
$sMessage = 0 === strlen($sMessage) ? str_replace('\\', '-', get_class($this)).' ('.
|
||||
basename($this->getFile()).' ~ '.$this->getLine().')' : $sMessage;
|
||||
|
|
|
|||
|
|
@ -744,10 +744,8 @@ class Http
|
|||
|
||||
/**
|
||||
* @param int $iStatus
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function StatusHeader($iStatus, $sCustomStatusText = '')
|
||||
public function StatusHeader($iStatus, $sCustomStatusText = '') : void
|
||||
{
|
||||
$iStatus = (int) $iStatus;
|
||||
if (99 < $iStatus)
|
||||
|
|
|
|||
|
|
@ -44,10 +44,8 @@ class Loader
|
|||
|
||||
/**
|
||||
* @staticvar bool $bIsInited
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function Init()
|
||||
public static function Init() : void
|
||||
{
|
||||
static $bIsInited = false;
|
||||
if (!$bIsInited)
|
||||
|
|
@ -64,10 +62,8 @@ class Loader
|
|||
/**
|
||||
* @param string $sName
|
||||
* @param int $iIncSize = 1
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function IncStatistic($sName, $iIncSize = 1)
|
||||
public static function IncStatistic($sName, $iIncSize = 1) : void
|
||||
{
|
||||
if (self::$StoreStatistic)
|
||||
{
|
||||
|
|
@ -79,10 +75,8 @@ class Loader
|
|||
/**
|
||||
* @param string $sName
|
||||
* @param mixed $mValue
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function SetStatistic($sName, $mValue)
|
||||
public static function SetStatistic($sName, $mValue) : void
|
||||
{
|
||||
if (self::$StoreStatistic)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -31,10 +31,8 @@ class ResourceRegistry
|
|||
|
||||
/**
|
||||
* @staticvar bool $bInited
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function regResourcesShutdownFunc()
|
||||
private static function regResourcesShutdownFunc() : void
|
||||
{
|
||||
static $bInited = false;
|
||||
if (!$bInited)
|
||||
|
|
@ -98,10 +96,8 @@ class ResourceRegistry
|
|||
|
||||
/**
|
||||
* @param resource $rResource
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function CloseMemoryResource(&$rResource)
|
||||
public static function CloseMemoryResource(&$rResource) : void
|
||||
{
|
||||
if (\is_resource($rResource))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17,30 +17,11 @@ namespace MailSo\Cache;
|
|||
*/
|
||||
interface DriverInterface
|
||||
{
|
||||
/**
|
||||
* @param string $sKey
|
||||
* @param string $sValue
|
||||
*/
|
||||
public function Set($sKey, $sValue) : bool;
|
||||
public function Set(string $sKey, string $sValue) : bool;
|
||||
|
||||
/**
|
||||
* @param string $sKey
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function Get($sKey);
|
||||
public function Get(string $sKey) : string;
|
||||
|
||||
/**
|
||||
* @param string $sKey
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function Delete($sKey);
|
||||
public function Delete(string $sKey) : void;
|
||||
|
||||
/**
|
||||
* @param int $iTimeToClearInHours = 24
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function GC($iTimeToClearInHours = 24);
|
||||
public function GC(int $iTimeToClearInHours = 24) : bool;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,12 +23,7 @@ class APC implements \MailSo\Cache\DriverInterface
|
|||
*/
|
||||
private $sKeyPrefix;
|
||||
|
||||
/**
|
||||
* @access private
|
||||
*
|
||||
* @param string $sKeyPrefix = ''
|
||||
*/
|
||||
private function __construct($sKeyPrefix = '')
|
||||
private function __construct(string $sKeyPrefix = '')
|
||||
{
|
||||
$this->sKeyPrefix = $sKeyPrefix;
|
||||
if (!empty($this->sKeyPrefix))
|
||||
|
|
@ -38,52 +33,28 @@ class APC implements \MailSo\Cache\DriverInterface
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sKeyPrefix = ''
|
||||
*
|
||||
* @return \MailSo\Cache\Drivers\APC
|
||||
*/
|
||||
public static function NewInstance($sKeyPrefix = '')
|
||||
public static function NewInstance(string $sKeyPrefix = '') : self
|
||||
{
|
||||
return new self($sKeyPrefix);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sKey
|
||||
* @param string $sValue
|
||||
*/
|
||||
public function Set($sKey, $sValue) : bool
|
||||
public function Set(string $sKey, string $sValue) : bool
|
||||
{
|
||||
return \apc_store($this->generateCachedKey($sKey), (string) $sValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sKey
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function Get($sKey)
|
||||
public function Get(string $sKey) : string
|
||||
{
|
||||
$sValue = \apc_fetch($this->generateCachedKey($sKey));
|
||||
return \is_string($sValue) ? $sValue : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sKey
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function Delete($sKey)
|
||||
public function Delete(string $sKey) : void
|
||||
{
|
||||
\apc_delete($this->generateCachedKey($sKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $iTimeToClearInHours = 24
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function GC($iTimeToClearInHours = 24)
|
||||
public function GC(int $iTimeToClearInHours = 24) : bool
|
||||
{
|
||||
if (0 === $iTimeToClearInHours)
|
||||
{
|
||||
|
|
@ -93,12 +64,7 @@ class APC implements \MailSo\Cache\DriverInterface
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sKey
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function generateCachedKey($sKey)
|
||||
private function generateCachedKey(string $sKey) : string
|
||||
{
|
||||
return $this->sKeyPrefix.\sha1($sKey);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,13 +28,7 @@ class File implements \MailSo\Cache\DriverInterface
|
|||
*/
|
||||
private $sKeyPrefix;
|
||||
|
||||
/**
|
||||
* @access private
|
||||
*
|
||||
* @param string $sCacheFolder
|
||||
* @param string $sKeyPrefix = ''
|
||||
*/
|
||||
private function __construct($sCacheFolder, $sKeyPrefix = '')
|
||||
private function __construct(string $sCacheFolder, string $sKeyPrefix = '')
|
||||
{
|
||||
$this->sCacheFolder = $sCacheFolder;
|
||||
$this->sCacheFolder = rtrim(trim($this->sCacheFolder), '\\/').'/';
|
||||
|
|
@ -51,33 +45,18 @@ class File implements \MailSo\Cache\DriverInterface
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sCacheFolder
|
||||
* @param string $sKeyPrefix = ''
|
||||
*
|
||||
* @return \MailSo\Cache\Drivers\File
|
||||
*/
|
||||
public static function NewInstance($sCacheFolder, $sKeyPrefix = '')
|
||||
public static function NewInstance(string $sCacheFolder, string $sKeyPrefix = '') : self
|
||||
{
|
||||
return new self($sCacheFolder, $sKeyPrefix);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sKey
|
||||
* @param string $sValue
|
||||
*/
|
||||
public function Set($sKey, $sValue) : bool
|
||||
public function Set(string $sKey, string $sValue) : bool
|
||||
{
|
||||
$sPath = $this->generateCachedFileName($sKey, true);
|
||||
return '' === $sPath ? false : false !== \file_put_contents($sPath, $sValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sKey
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function Get($sKey)
|
||||
public function Get(string $sKey) : string
|
||||
{
|
||||
$sValue = '';
|
||||
$sPath = $this->generateCachedFileName($sKey);
|
||||
|
|
@ -89,12 +68,7 @@ class File implements \MailSo\Cache\DriverInterface
|
|||
return \is_string($sValue) ? $sValue : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sKey
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function Delete($sKey)
|
||||
public function Delete(string $sKey) : void
|
||||
{
|
||||
$sPath = $this->generateCachedFileName($sKey);
|
||||
if ('' !== $sPath && \file_exists($sPath))
|
||||
|
|
@ -103,12 +77,7 @@ class File implements \MailSo\Cache\DriverInterface
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $iTimeToClearInHours = 24
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function GC($iTimeToClearInHours = 24)
|
||||
public function GC(int $iTimeToClearInHours = 24) : bool
|
||||
{
|
||||
if (0 < $iTimeToClearInHours)
|
||||
{
|
||||
|
|
@ -119,13 +88,7 @@ class File implements \MailSo\Cache\DriverInterface
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sKey
|
||||
* @param bool $bMkDir = false
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function generateCachedFileName($sKey, $bMkDir = false)
|
||||
private function generateCachedFileName(string $sKey, bool $bMkDir = false) : string
|
||||
{
|
||||
$sFilePath = '';
|
||||
if (3 < \strlen($sKey))
|
||||
|
|
|
|||
|
|
@ -43,13 +43,7 @@ class Memcache implements \MailSo\Cache\DriverInterface
|
|||
*/
|
||||
private $sKeyPrefix;
|
||||
|
||||
/**
|
||||
* @param string $sHost = '127.0.0.1'
|
||||
* @param int $iPost = 11211
|
||||
* @param int $iExpire = 43200
|
||||
* @param string $sKeyPrefix = ''
|
||||
*/
|
||||
private function __construct($sHost = '127.0.0.1', $iPost = 11211, $iExpire = 43200, $sKeyPrefix = '')
|
||||
private function __construct(string $sHost = '127.0.0.1', int $iPost = 11211, int $iExpire = 43200, string $sKeyPrefix = '')
|
||||
{
|
||||
$this->sHost = $sHost;
|
||||
$this->iPost = $iPost;
|
||||
|
|
@ -69,45 +63,23 @@ class Memcache implements \MailSo\Cache\DriverInterface
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sHost = '127.0.0.1'
|
||||
* @param int $iPost = 11211
|
||||
* @param int $iExpire = 43200
|
||||
* @param string $sKeyPrefix = ''
|
||||
*
|
||||
* @return \MailSo\Cache\Drivers\APC
|
||||
*/
|
||||
public static function NewInstance($sHost = '127.0.0.1', $iPost = 11211, $iExpire = 43200, $sKeyPrefix = '')
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sKey
|
||||
* @param string $sValue
|
||||
*/
|
||||
public function Set($sKey, $sValue) : bool
|
||||
public function Set(string $sKey, string $sValue) : bool
|
||||
{
|
||||
return $this->oMem ? $this->oMem->set($this->generateCachedKey($sKey), $sValue, 0, $this->iExpire) : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sKey
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function Get($sKey)
|
||||
public function Get(string $sKey) : string
|
||||
{
|
||||
$sValue = $this->oMem ? $this->oMem->get($this->generateCachedKey($sKey)) : '';
|
||||
return \is_string($sValue) ? $sValue : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sKey
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function Delete($sKey)
|
||||
public function Delete(string $sKey) : void
|
||||
{
|
||||
if ($this->oMem)
|
||||
{
|
||||
|
|
@ -115,12 +87,7 @@ class Memcache implements \MailSo\Cache\DriverInterface
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $iTimeToClearInHours = 24
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function GC($iTimeToClearInHours = 24)
|
||||
public function GC(int $iTimeToClearInHours = 24) : bool
|
||||
{
|
||||
if (0 === $iTimeToClearInHours && $this->oMem)
|
||||
{
|
||||
|
|
@ -130,12 +97,7 @@ class Memcache implements \MailSo\Cache\DriverInterface
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sKey
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function generateCachedKey($sKey)
|
||||
private function generateCachedKey(string $sKey) : string
|
||||
{
|
||||
return $this->sKeyPrefix.\sha1($sKey);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,13 +43,7 @@ class Redis implements \MailSo\Cache\DriverInterface
|
|||
*/
|
||||
private $sKeyPrefix;
|
||||
|
||||
/**
|
||||
* @param string $sHost = '127.0.0.1'
|
||||
* @param int $iPost = 6379
|
||||
* @param int $iExpire = 43200
|
||||
* @param string $sKeyPrefix = ''
|
||||
*/
|
||||
private function __construct($sHost = '127.0.0.1', $iPost = 6379, $iExpire = 43200, $sKeyPrefix = '')
|
||||
private function __construct(string $sHost = '127.0.0.1', int $iPost = 6379, int $iExpire = 43200, string $sKeyPrefix = '')
|
||||
{
|
||||
$this->sHost = $sHost;
|
||||
$this->iPost = $iPost;
|
||||
|
|
@ -85,45 +79,23 @@ class Redis implements \MailSo\Cache\DriverInterface
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sHost = '127.0.0.1'
|
||||
* @param int $iPost = 11211
|
||||
* @param int $iExpire = 43200
|
||||
* @param string $sKeyPrefix = ''
|
||||
*
|
||||
* @return \MailSo\Cache\Drivers\APC
|
||||
*/
|
||||
public static function NewInstance($sHost = '127.0.0.1', $iPost = 6379, $iExpire = 43200, $sKeyPrefix = '')
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sKey
|
||||
* @param string $sValue
|
||||
*/
|
||||
public function Set($sKey, $sValue) : bool
|
||||
public function Set(string $sKey, string $sValue) : bool
|
||||
{
|
||||
return $this->oRedis ? $this->oRedis->setex($this->generateCachedKey($sKey), $this->iExpire, $sValue) : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sKey
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function Get($sKey)
|
||||
public function Get(string $sKey) : string
|
||||
{
|
||||
$sValue = $this->oRedis ? $this->oRedis->get($this->generateCachedKey($sKey)) : '';
|
||||
return \is_string($sValue) ? $sValue : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sKey
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function Delete($sKey)
|
||||
public function Delete(string $sKey) : void
|
||||
{
|
||||
if ($this->oRedis)
|
||||
{
|
||||
|
|
@ -131,12 +103,7 @@ class Redis implements \MailSo\Cache\DriverInterface
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $iTimeToClearInHours = 24
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function GC($iTimeToClearInHours = 24)
|
||||
public function GC(int $iTimeToClearInHours = 24) : bool
|
||||
{
|
||||
if (0 === $iTimeToClearInHours && $this->oRedis)
|
||||
{
|
||||
|
|
@ -146,12 +113,7 @@ class Redis implements \MailSo\Cache\DriverInterface
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sKey
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function generateCachedKey($sKey)
|
||||
private function generateCachedKey(string $sKey) : string
|
||||
{
|
||||
return $this->sKeyPrefix.\sha1($sKey);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,13 +23,7 @@ class ResponseException extends \MailSo\Imap\Exceptions\Exception
|
|||
*/
|
||||
private $aResponses;
|
||||
|
||||
/**
|
||||
* @param array $aResponses = array
|
||||
* @param string $sMessage = ''
|
||||
* @param int $iCode = 0
|
||||
* @param \Exception $oPrevious = null
|
||||
*/
|
||||
public function __construct($aResponses = array(), $sMessage = '', $iCode = 0, $oPrevious = null)
|
||||
public function __construct(array $aResponses = array(), string $sMessage = '', int $iCode = 0, ?\Throwable $oPrevious = null)
|
||||
{
|
||||
parent::__construct($sMessage, $iCode, $oPrevious);
|
||||
|
||||
|
|
@ -39,18 +33,12 @@ class ResponseException extends \MailSo\Imap\Exceptions\Exception
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function GetResponses()
|
||||
public function GetResponses() : array
|
||||
{
|
||||
return $this->aResponses;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \MailSo\Imap\Response|null
|
||||
*/
|
||||
public function GetLastResponse()
|
||||
public function GetLastResponse() : ?Response
|
||||
{
|
||||
return 0 < count($this->aResponses) ? $this->aResponses[count($this->aResponses) - 1] : null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,32 +27,21 @@ class FetchResponse
|
|||
*/
|
||||
private $aEnvelopeCache;
|
||||
|
||||
/**
|
||||
* @access private
|
||||
*
|
||||
* @param \MailSo\Imap\Response $oImapResponse
|
||||
*/
|
||||
private function __construct($oImapResponse)
|
||||
private function __construct(Response $oImapResponse)
|
||||
{
|
||||
$this->oImapResponse = $oImapResponse;
|
||||
$this->aEnvelopeCache = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \MailSo\Imap\Response $oImapResponse
|
||||
* @return \MailSo\Imap\FetchResponse
|
||||
*/
|
||||
public static function NewInstance($oImapResponse)
|
||||
public static function NewInstance(Response $oImapResponse) : self
|
||||
{
|
||||
return new self($oImapResponse);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $bForce = false
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public function GetEnvelope($bForce = false)
|
||||
public function GetEnvelope(bool $bForce = false)
|
||||
{
|
||||
if (null === $this->aEnvelopeCache || $bForce)
|
||||
{
|
||||
|
|
@ -62,23 +51,19 @@ class FetchResponse
|
|||
}
|
||||
|
||||
/**
|
||||
* @param int $iIndex
|
||||
* @param mixed $mNullResult = null
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function GetFetchEnvelopeValue($iIndex, $mNullResult)
|
||||
public function GetFetchEnvelopeValue(int $iIndex, $mNullResult)
|
||||
{
|
||||
return self::findEnvelopeIndex($this->GetEnvelope(), $iIndex, $mNullResult);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $iIndex
|
||||
* @param string $sParentCharset = \MailSo\Base\Enumerations\Charset::ISO_8859_1
|
||||
*
|
||||
* @return \MailSo\Mime\EmailCollection|null
|
||||
*/
|
||||
public function GetFetchEnvelopeEmailCollection($iIndex, $sParentCharset = \MailSo\Base\Enumerations\Charset::ISO_8859_1)
|
||||
public function GetFetchEnvelopeEmailCollection(int $iIndex, string $sParentCharset = \MailSo\Base\Enumerations\Charset::ISO_8859_1)
|
||||
{
|
||||
$oResult = null;
|
||||
$aEmails = $this->GetFetchEnvelopeValue($iIndex, null);
|
||||
|
|
@ -112,11 +97,9 @@ class FetchResponse
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $sRfc822SubMimeIndex = ''
|
||||
*
|
||||
* @return \MailSo\Imap\BodyStructure|null
|
||||
*/
|
||||
public function GetFetchBodyStructure($sRfc822SubMimeIndex = '')
|
||||
public function GetFetchBodyStructure(string $sRfc822SubMimeIndex = '')
|
||||
{
|
||||
$oBodyStructure = null;
|
||||
$aBodyStructureArray = $this->GetFetchValue(Enumerations\FetchType::BODYSTRUCTURE);
|
||||
|
|
@ -137,11 +120,9 @@ class FetchResponse
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $sFetchItemName
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function GetFetchValue($sFetchItemName)
|
||||
public function GetFetchValue(string $sFetchItemName)
|
||||
{
|
||||
$mReturn = null;
|
||||
$bNextIsValue = false;
|
||||
|
|
@ -170,12 +151,7 @@ class FetchResponse
|
|||
return $mReturn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sRfc822SubMimeIndex = ''
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function GetHeaderFieldsValue($sRfc822SubMimeIndex = '')
|
||||
public function GetHeaderFieldsValue(string $sRfc822SubMimeIndex = '') : string
|
||||
{
|
||||
$sReturn = '';
|
||||
$bNextIsValue = false;
|
||||
|
|
@ -227,12 +203,7 @@ class FetchResponse
|
|||
return $bUid && $bSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \MailSo\Imap\Response $oImapResponse
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function IsValidFetchImapResponse($oImapResponse)
|
||||
public static function IsValidFetchImapResponse(Response $oImapResponse) : bool
|
||||
{
|
||||
return (
|
||||
$oImapResponse
|
||||
|
|
@ -243,12 +214,7 @@ class FetchResponse
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \MailSo\Imap\Response $oImapResponse
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function IsNotEmptyFetchImapResponse($oImapResponse)
|
||||
public static function IsNotEmptyFetchImapResponse(Response $oImapResponse) : bool
|
||||
{
|
||||
return (
|
||||
$oImapResponse
|
||||
|
|
@ -259,13 +225,11 @@ class FetchResponse
|
|||
}
|
||||
|
||||
/**
|
||||
* @param array $aEnvelope
|
||||
* @param int $iIndex
|
||||
* @param mixed $mNullResult = null
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
private static function findEnvelopeIndex($aEnvelope, $iIndex, $mNullResult)
|
||||
private static function findEnvelopeIndex(array $aEnvelope, int $iIndex, $mNullResult)
|
||||
{
|
||||
return (isset($aEnvelope[$iIndex]) && 'NIL' !== $aEnvelope[$iIndex] && '' !== $aEnvelope[$iIndex])
|
||||
? $aEnvelope[$iIndex] : $mNullResult;
|
||||
|
|
|
|||
|
|
@ -139,8 +139,6 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
* @param bool $bAllowSelfSigned = true
|
||||
* @param string $sClientCert = ''
|
||||
*
|
||||
* @return \MailSo\Imap\ImapClient
|
||||
*
|
||||
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
|
||||
* @throws \MailSo\Net\Exceptions\Exception
|
||||
* @throws \MailSo\Imap\Exceptions\Exception
|
||||
|
|
@ -148,7 +146,7 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
public function Connect($sServerName, $iPort = 143,
|
||||
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT,
|
||||
$bVerifySsl = false, $bAllowSelfSigned = true,
|
||||
$sClientCert = '')
|
||||
$sClientCert = '') : void
|
||||
{
|
||||
$this->aTagTimeouts['*'] = \microtime(true);
|
||||
|
||||
|
|
@ -170,8 +168,6 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
new \MailSo\Net\Exceptions\SocketUnsuppoterdSecureConnectionException('STARTTLS is not supported'),
|
||||
\MailSo\Log\Enumerations\Type::ERROR, true);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _xor($string, $string2)
|
||||
|
|
@ -788,10 +784,8 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
* @param array $aResult
|
||||
* @param string $sFolderName
|
||||
* @param bool $bIsWritable
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function initCurrentFolderInformation($aResult, $sFolderName, $bIsWritable)
|
||||
protected function initCurrentFolderInformation($aResult, $sFolderName, $bIsWritable) : void
|
||||
{
|
||||
if (\is_array($aResult))
|
||||
{
|
||||
|
|
@ -1895,10 +1889,8 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
|
||||
/**
|
||||
* @param \MailSo\Imap\Response $oImapResponse
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function initCapabilityImapResponse($oImapResponse)
|
||||
private function initCapabilityImapResponse($oImapResponse) : void
|
||||
{
|
||||
if (\MailSo\Imap\Enumerations\ResponseType::UNTAGGED === $oImapResponse->ResponseType
|
||||
&& \is_array($oImapResponse->ResponseList))
|
||||
|
|
@ -2568,20 +2560,6 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
return 'IMAP';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \MailSo\Log\Logger $oLogger
|
||||
*
|
||||
* @return \MailSo\Imap\ImapClient
|
||||
*
|
||||
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
|
||||
*/
|
||||
public function SetLogger($oLogger)
|
||||
{
|
||||
parent::SetLogger($oLogger);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param resource $rConnect
|
||||
* @param array $aCapabilityItems = array()
|
||||
|
|
|
|||
|
|
@ -392,9 +392,8 @@ abstract class Driver
|
|||
|
||||
/**
|
||||
* @final
|
||||
* @return void
|
||||
*/
|
||||
final public function WriteEmptyLine()
|
||||
final public function WriteEmptyLine() : void
|
||||
{
|
||||
if (!$this->bFlushCache && ($this->bWriteOnErrorOnly || $this->bWriteOnPhpErrorOnly || 0 < $this->iWriteOnTimeoutOnly))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -250,10 +250,7 @@ class Logger extends \MailSo\Base\Collection
|
|||
return !!(\MailSo\Log\Enumerations\Type::NOTICE === $iType && $this->bHideErrorNotices);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function __loggerShutDown()
|
||||
public function __loggerShutDown() : void
|
||||
{
|
||||
if ($this->bUsed)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -157,10 +157,8 @@ class FolderCollection extends \MailSo\Base\Collection
|
|||
|
||||
/**
|
||||
* @param array $aUnsortedMailFolders
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function InitByUnsortedMailFolderArray($aUnsortedMailFolders)
|
||||
public function InitByUnsortedMailFolderArray($aUnsortedMailFolders) : void
|
||||
{
|
||||
$this->Clear();
|
||||
|
||||
|
|
@ -256,10 +254,8 @@ class FolderCollection extends \MailSo\Base\Collection
|
|||
|
||||
/**
|
||||
* @param callable $fCallback
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function SortByCallback($fCallback)
|
||||
public function SortByCallback($fCallback) : void
|
||||
{
|
||||
if (\is_callable($fCallback))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -711,11 +711,9 @@ class MailClient
|
|||
* @param int $iUnseenCount
|
||||
* @param string $sUidNext
|
||||
* @param string $sHighestModSeq
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function initFolderValues($sFolderName, &$iCount, &$iUnseenCount,
|
||||
&$sUidNext, &$sHighestModSeq = '')
|
||||
&$sUidNext, &$sHighestModSeq = '') : void
|
||||
{
|
||||
$aTypes = array(
|
||||
\MailSo\Imap\Enumerations\FolderResponseStatus::MESSAGES,
|
||||
|
|
@ -1850,7 +1848,7 @@ class MailClient
|
|||
if (!\is_array($aResultUids))
|
||||
{
|
||||
$aResultUids = $bUseSortIfSupported ?
|
||||
$this->oImapClient->MessageSimpleSort(array('REVERSE ARRIVAL'), $sSearchCriterias, true) :
|
||||
$this->oImapClient->MessageSimpleSort(array('REVERSE DATE'), $sSearchCriterias, true) :
|
||||
$this->oImapClient->MessageSimpleSearch($sSearchCriterias, true, \MailSo\Base\Utils::IsAscii($sSearchCriterias) ? '' : 'UTF-8')
|
||||
;
|
||||
|
||||
|
|
|
|||
|
|
@ -95,10 +95,7 @@ class MessageCollection extends \MailSo\Base\Collection
|
|||
return new self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \MailSo\Mail\MessageCollection
|
||||
*/
|
||||
public function Clear()
|
||||
public function Clear() : void
|
||||
{
|
||||
parent::Clear();
|
||||
|
||||
|
|
@ -117,7 +114,5 @@ class MessageCollection extends \MailSo\Base\Collection
|
|||
$this->NewMessages = array();
|
||||
|
||||
$this->Filtered = false;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,10 +66,8 @@ class Header
|
|||
* @param string $sName
|
||||
* @param string $sValue
|
||||
* @param string $sEncodedValueForReparse
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function initInputData($sName, $sValue, $sEncodedValueForReparse)
|
||||
private function initInputData($sName, $sValue, $sEncodedValueForReparse) : void
|
||||
{
|
||||
$this->sName = trim($sName);
|
||||
$this->sFullValue = trim($sValue);
|
||||
|
|
|
|||
|
|
@ -211,19 +211,6 @@ class HeaderCollection extends \MailSo\Base\Collection
|
|||
return $oResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $aList
|
||||
* @return \MailSo\Mime\HeaderCollection
|
||||
*
|
||||
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
|
||||
*/
|
||||
public function SetAsArray($aList)
|
||||
{
|
||||
parent::SetAsArray($aList);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sParentCharset
|
||||
* @return \MailSo\Mime\HeaderCollection
|
||||
|
|
@ -249,10 +236,7 @@ class HeaderCollection extends \MailSo\Base\Collection
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function Clear()
|
||||
public function Clear() : void
|
||||
{
|
||||
parent::Clear();
|
||||
|
||||
|
|
|
|||
|
|
@ -97,20 +97,16 @@ class Message
|
|||
|
||||
/**
|
||||
* @param string $sMessageId
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function SetMessageId($sMessageId)
|
||||
public function SetMessageId($sMessageId) : void
|
||||
{
|
||||
$this->aHeadersValue[\MailSo\Mime\Enumerations\Header::MESSAGE_ID] = $sMessageId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sHostName = ''
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function RegenerateMessageId($sHostName = '')
|
||||
public function RegenerateMessageId($sHostName = '') : void
|
||||
{
|
||||
$this->SetMessageId($this->generateNewMessageId($sHostName));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,20 +52,6 @@ class ParameterCollection extends \MailSo\Base\Collection
|
|||
return $mResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $aList
|
||||
*
|
||||
* @return \MailSo\Mime\ParameterCollection
|
||||
*
|
||||
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
|
||||
*/
|
||||
public function SetAsArray($aList)
|
||||
{
|
||||
parent::SetAsArray($aList);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sName
|
||||
*
|
||||
|
|
@ -131,10 +117,7 @@ class ParameterCollection extends \MailSo\Base\Collection
|
|||
return 0 < \count($aResult) ? \implode('; ', $aResult) : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
private function reParseParameters()
|
||||
private function reParseParameters() : void
|
||||
{
|
||||
$aDataToReParse = $this->CloneAsArray();
|
||||
$sCharset = \MailSo\Base\Enumerations\Charset::UTF_8;
|
||||
|
|
|
|||
|
|
@ -18,64 +18,31 @@ namespace MailSo\Mime\Parser;
|
|||
*/
|
||||
class ParserEmpty implements ParserInterface
|
||||
{
|
||||
/**
|
||||
* @param \MailSo\Mime\Part $oPart
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function StartParse(\MailSo\Mime\Part &$oPart)
|
||||
public function StartParse(\MailSo\Mime\Part $oPart) : void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \MailSo\Mime\Part $oPart
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function EndParse(\MailSo\Mime\Part &$oPart)
|
||||
public function EndParse(\MailSo\Mime\Part $oPart) : void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \MailSo\Mime\Part $oPart
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function StartParseMimePart(\MailSo\Mime\Part &$oPart)
|
||||
public function StartParseMimePart(\MailSo\Mime\Part $oPart) : void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \MailSo\Mime\Part $oMimePart
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function EndParseMimePart(\MailSo\Mime\Part &$oPart)
|
||||
public function EndParseMimePart(\MailSo\Mime\Part $oPart) : void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function InitMimePartHeader()
|
||||
public function InitMimePartHeader() : void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sBuffer
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function ReadBuffer($sBuffer)
|
||||
public function ReadBuffer(string $sBuffer) : void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sBuffer
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function WriteBody($sBuffer)
|
||||
public function WriteBody(string $sBuffer) : void
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,49 +18,17 @@ namespace MailSo\Mime\Parser;
|
|||
*/
|
||||
interface ParserInterface
|
||||
{
|
||||
/**
|
||||
* @param \MailSo\Mime\Part $oPart
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function StartParse(\MailSo\Mime\Part &$oPart);
|
||||
public function StartParse(\MailSo\Mime\Part $oPart) : void;
|
||||
|
||||
/**
|
||||
* @param \MailSo\Mime\Part $oPart
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function EndParse(\MailSo\Mime\Part &$oPart);
|
||||
public function EndParse(\MailSo\Mime\Part $oPart) : void;
|
||||
|
||||
/**
|
||||
* @param \MailSo\Mime\Part $oPart
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function StartParseMimePart(\MailSo\Mime\Part &$oPart);
|
||||
public function StartParseMimePart(\MailSo\Mime\Part $oPart) : void;
|
||||
|
||||
/**
|
||||
* @param \MailSo\Mime\Part $oMimePart
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function EndParseMimePart(\MailSo\Mime\Part &$oPart);
|
||||
public function EndParseMimePart(\MailSo\Mime\Part $oPart) : void;
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function InitMimePartHeader();
|
||||
public function InitMimePartHeader() : void;
|
||||
|
||||
/**
|
||||
* @param string $sBuffer
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function ReadBuffer($sBuffer);
|
||||
public function ReadBuffer(string $sBuffer) : void;
|
||||
|
||||
/**
|
||||
* @param string $sBuffer
|
||||
* @return void
|
||||
*/
|
||||
public function WriteBody($sBuffer);
|
||||
public function WriteBody(string $sBuffer) : void;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,22 +23,12 @@ class ParserMemory extends ParserEmpty implements ParserInterface
|
|||
*/
|
||||
protected $oCurrentMime = null;
|
||||
|
||||
/**
|
||||
* @param \MailSo\Mime\Part $oMimePart
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function StartParseMimePart(\MailSo\Mime\Part &$oPart)
|
||||
public function StartParseMimePart(\MailSo\Mime\Part $oPart) : void
|
||||
{
|
||||
$this->oCurrentMime = $oPart;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sBuffer
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function WriteBody($sBuffer)
|
||||
public function WriteBody(string $sBuffer) : void
|
||||
{
|
||||
if (null === $this->oCurrentMime->Body)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -108,9 +108,6 @@ abstract class NetClient
|
|||
$this->Clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
try
|
||||
|
|
@ -127,10 +124,7 @@ abstract class NetClient
|
|||
catch (\Exception $oException) {}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function Clear()
|
||||
public function Clear() : void
|
||||
{
|
||||
$this->sResponseBuffer = '';
|
||||
|
||||
|
|
@ -141,32 +135,20 @@ abstract class NetClient
|
|||
$this->bSecure = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function GetConnectedHost()
|
||||
public function GetConnectedHost() : string
|
||||
{
|
||||
return $this->sConnectedHost;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function GetConnectedPort()
|
||||
public function GetConnectedPort() : int
|
||||
{
|
||||
return $this->iConnectedPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $iConnectTimeOut = 10
|
||||
* @param int $iSocketTimeOut = 10
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function SetTimeOuts($iConnectTimeOut = 10, $iSocketTimeOut = 10)
|
||||
public function SetTimeOuts(int $iConnectTimeOut = 10, int $iSocketTimeOut = 10) : void
|
||||
{
|
||||
$this->iConnectTimeOut = 5 < $iConnectTimeOut ? $iConnectTimeOut : 5;
|
||||
$this->iSocketTimeOut = 5 < $iSocketTimeOut ? $iSocketTimeOut : 5;
|
||||
$this->iConnectTimeOut = max(5, $iConnectTimeOut);
|
||||
$this->iSocketTimeOut = max(5, $iSocketTimeOut);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -198,8 +180,6 @@ abstract class NetClient
|
|||
* @param bool $bAllowSelfSigned = true
|
||||
* @param string $sClientCert = ''
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
|
||||
* @throws \MailSo\Net\Exceptions\SocketAlreadyConnectedException
|
||||
* @throws \MailSo\Net\Exceptions\SocketCanNotConnectToHostException
|
||||
|
|
@ -207,7 +187,7 @@ abstract class NetClient
|
|||
public function Connect($sServerName, $iPort,
|
||||
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT,
|
||||
$bVerifySsl = false, $bAllowSelfSigned = true,
|
||||
$sClientCert = '')
|
||||
$sClientCert = '') : void
|
||||
{
|
||||
if (!\MailSo\Base\Validator::NotEmptyString($sServerName, true) || !\MailSo\Base\Validator::PortInt($iPort))
|
||||
{
|
||||
|
|
@ -340,10 +320,7 @@ abstract class NetClient
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function Disconnect()
|
||||
public function Disconnect() : void
|
||||
{
|
||||
if (\is_resource($this->rConnect))
|
||||
{
|
||||
|
|
@ -365,11 +342,9 @@ abstract class NetClient
|
|||
}
|
||||
|
||||
/**
|
||||
* @retun void
|
||||
*
|
||||
* @throws \MailSo\Net\Exceptions\Exception
|
||||
*/
|
||||
public function LogoutAndDisconnect()
|
||||
public function LogoutAndDisconnect() : void
|
||||
{
|
||||
if (\method_exists($this, 'Logout') && !$this->bUnreadBuffer && !$this->bRunningCallback)
|
||||
{
|
||||
|
|
@ -398,11 +373,9 @@ abstract class NetClient
|
|||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*
|
||||
* @throws \MailSo\Net\Exceptions\SocketConnectionDoesNotAvailableException
|
||||
*/
|
||||
public function IsConnectedWithException()
|
||||
public function IsConnectedWithException() : void
|
||||
{
|
||||
$this->IsConnected(true);
|
||||
}
|
||||
|
|
@ -421,12 +394,10 @@ abstract class NetClient
|
|||
* @param bool $bWriteToLog = true
|
||||
* @param string $sFakeRaw = ''
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws \MailSo\Net\Exceptions\SocketConnectionDoesNotAvailableException
|
||||
* @throws \MailSo\Net\Exceptions\SocketWriteException
|
||||
*/
|
||||
protected function sendRaw($sRaw, $bWriteToLog = true, $sFakeRaw = '')
|
||||
protected function sendRaw($sRaw, $bWriteToLog = true, $sFakeRaw = '') : void
|
||||
{
|
||||
if ($this->bUnreadBuffer)
|
||||
{
|
||||
|
|
@ -473,12 +444,10 @@ abstract class NetClient
|
|||
* @param mixed $mReadLen = null
|
||||
* @param bool $bForceLogin = false
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws \MailSo\Net\Exceptions\SocketConnectionDoesNotAvailableException
|
||||
* @throws \MailSo\Net\Exceptions\SocketReadException
|
||||
*/
|
||||
protected function getNextBuffer($mReadLen = null, $bForceLogin = false)
|
||||
protected function getNextBuffer($mReadLen = null, $bForceLogin = false) : void
|
||||
{
|
||||
if (null === $mReadLen)
|
||||
{
|
||||
|
|
@ -562,10 +531,8 @@ abstract class NetClient
|
|||
/**
|
||||
* @param string $sDesc
|
||||
* @param int $iDescType = \MailSo\Log\Enumerations\Type::INFO
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function writeLog($sDesc, $iDescType = \MailSo\Log\Enumerations\Type::INFO, $bDiplayCrLf = false)
|
||||
protected function writeLog($sDesc, $iDescType = \MailSo\Log\Enumerations\Type::INFO, $bDiplayCrLf = false) : void
|
||||
{
|
||||
if ($this->oLogger)
|
||||
{
|
||||
|
|
@ -576,10 +543,8 @@ abstract class NetClient
|
|||
/**
|
||||
* @param string $sDesc
|
||||
* @param int $iDescType = \MailSo\Log\Enumerations\Type::INFO
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function writeLogWithCrlf($sDesc, $iDescType = \MailSo\Log\Enumerations\Type::INFO)
|
||||
protected function writeLogWithCrlf($sDesc, $iDescType = \MailSo\Log\Enumerations\Type::INFO) : void
|
||||
{
|
||||
$this->writeLog($sDesc, $iDescType, true);
|
||||
}
|
||||
|
|
@ -588,11 +553,9 @@ abstract class NetClient
|
|||
* @param \Exception $oException
|
||||
* @param int $iDescType = \MailSo\Log\Enumerations\Type::NOTICE
|
||||
* @param bool $bThrowException = false
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function writeLogException($oException,
|
||||
$iDescType = \MailSo\Log\Enumerations\Type::NOTICE, $bThrowException = false)
|
||||
$iDescType = \MailSo\Log\Enumerations\Type::NOTICE, $bThrowException = false) : void
|
||||
{
|
||||
if ($this->oLogger)
|
||||
{
|
||||
|
|
@ -613,11 +576,9 @@ abstract class NetClient
|
|||
/**
|
||||
* @param \MailSo\Log\Logger $oLogger
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
|
||||
*/
|
||||
public function SetLogger($oLogger)
|
||||
public function SetLogger($oLogger) : void
|
||||
{
|
||||
if (!($oLogger instanceof \MailSo\Log\Logger))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -105,15 +105,13 @@ class ManageSieveClient extends \MailSo\Net\NetClient
|
|||
* @param bool $bVerifySsl = false
|
||||
* @param bool $bAllowSelfSigned = true
|
||||
*
|
||||
* @return \MailSo\Sieve\ManageSieveClient
|
||||
*
|
||||
* @throws \MailSo\Net\Exceptions\Exception
|
||||
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
|
||||
* @throws \MailSo\Sieve\Exceptions\ResponseException
|
||||
*/
|
||||
public function Connect($sServerName, $iPort,
|
||||
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT,
|
||||
$bVerifySsl = false, $bAllowSelfSigned = true)
|
||||
$bVerifySsl = false, $bAllowSelfSigned = true, $sClientCert = '') : void
|
||||
{
|
||||
$this->iRequestTime = \microtime(true);
|
||||
|
||||
|
|
@ -139,8 +137,6 @@ class ManageSieveClient extends \MailSo\Net\NetClient
|
|||
new \MailSo\Net\Exceptions\SocketUnsuppoterdSecureConnectionException('STARTTLS is not supported'),
|
||||
\MailSo\Log\Enumerations\Type::ERROR, true);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -478,12 +474,10 @@ class ManageSieveClient extends \MailSo\Net\NetClient
|
|||
/**
|
||||
* @param string $mResponse
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
|
||||
* @throws \MailSo\Net\Exceptions\Exception
|
||||
*/
|
||||
private function parseStartupResponse($mResponse)
|
||||
private function parseStartupResponse($mResponse) : void
|
||||
{
|
||||
foreach ($mResponse as $sLine)
|
||||
{
|
||||
|
|
@ -515,12 +509,10 @@ class ManageSieveClient extends \MailSo\Net\NetClient
|
|||
/**
|
||||
* @param string $sRequest
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
|
||||
* @throws \MailSo\Net\Exceptions\Exception
|
||||
*/
|
||||
private function sendRequest($sRequest)
|
||||
private function sendRequest($sRequest) : void
|
||||
{
|
||||
if (!\MailSo\Base\Validator::NotEmptyString($sRequest, true))
|
||||
{
|
||||
|
|
@ -537,13 +529,11 @@ class ManageSieveClient extends \MailSo\Net\NetClient
|
|||
/**
|
||||
* @param string $sRequest
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
|
||||
* @throws \MailSo\Net\Exceptions\Exception
|
||||
* @throws \MailSo\Sieve\Exceptions\NegativeResponseException
|
||||
*/
|
||||
private function sendRequestWithCheck($sRequest)
|
||||
private function sendRequestWithCheck($sRequest) : void
|
||||
{
|
||||
$this->sendRequest($sRequest);
|
||||
$this->validateResponse($this->parseResponse());
|
||||
|
|
@ -637,17 +627,4 @@ class ManageSieveClient extends \MailSo\Net\NetClient
|
|||
return 'SIEVE';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \MailSo\Log\Logger $oLogger
|
||||
*
|
||||
* @return \MailSo\Sieve\ManageSieveClient
|
||||
*
|
||||
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
|
||||
*/
|
||||
public function SetLogger($oLogger)
|
||||
{
|
||||
parent::SetLogger($oLogger);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,15 +153,13 @@ class SmtpClient extends \MailSo\Net\NetClient
|
|||
* @param bool $bVerifySsl = false
|
||||
* @param bool $bAllowSelfSigned = true
|
||||
*
|
||||
* @return \MailSo\Smtp\SmtpClient
|
||||
*
|
||||
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
|
||||
* @throws \MailSo\Net\Exceptions\Exception
|
||||
* @throws \MailSo\Smtp\Exceptions\ResponseException
|
||||
*/
|
||||
public function Connect($sServerName, $iPort = 25, $sEhloHost = '[127.0.0.1]',
|
||||
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT,
|
||||
$bVerifySsl = false, $bAllowSelfSigned = true)
|
||||
$bVerifySsl = false, $bAllowSelfSigned = true) : void
|
||||
{
|
||||
$this->iRequestTime = microtime(true);
|
||||
|
||||
|
|
@ -170,8 +168,6 @@ class SmtpClient extends \MailSo\Net\NetClient
|
|||
$this->validateResponse(220);
|
||||
|
||||
$this->preLoginStartTLSAndEhloProcess($sEhloHost);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -556,10 +552,8 @@ class SmtpClient extends \MailSo\Net\NetClient
|
|||
|
||||
/**
|
||||
* @param string $sEhloHost
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function preLoginStartTLSAndEhloProcess($sEhloHost)
|
||||
private function preLoginStartTLSAndEhloProcess($sEhloHost) : void
|
||||
{
|
||||
if ($this->bHelo)
|
||||
{
|
||||
|
|
@ -593,12 +587,10 @@ class SmtpClient extends \MailSo\Net\NetClient
|
|||
* @param string $sAddToCommand = ''
|
||||
* @param bool $bSecureLog = false
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
|
||||
* @throws \MailSo\Net\Exceptions\Exception
|
||||
*/
|
||||
private function sendRequest($sCommand, $sAddToCommand = '', $bSecureLog = false)
|
||||
private function sendRequest($sCommand, $sAddToCommand = '', $bSecureLog = false) : void
|
||||
{
|
||||
if (!\MailSo\Base\Validator::NotEmptyString($sCommand, true))
|
||||
{
|
||||
|
|
@ -616,8 +608,6 @@ class SmtpClient extends \MailSo\Net\NetClient
|
|||
|
||||
$this->iRequestTime = \microtime(true);
|
||||
$this->sendRaw($sRealCommand, true, $sFakeCommand);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -627,13 +617,11 @@ class SmtpClient extends \MailSo\Net\NetClient
|
|||
* @param bool $bSecureLog = false
|
||||
* @param string $sErrorPrefix = ''
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
|
||||
* @throws \MailSo\Net\Exceptions\Exception
|
||||
* @throws \MailSo\Smtp\Exceptions\Exception
|
||||
*/
|
||||
private function sendRequestWithCheck($sCommand, $mExpectCode, $sAddToCommand = '', $bSecureLog = false, $sErrorPrefix = '')
|
||||
private function sendRequestWithCheck($sCommand, $mExpectCode, $sAddToCommand = '', $bSecureLog = false, $sErrorPrefix = '') : void
|
||||
{
|
||||
$this->sendRequest($sCommand, $sAddToCommand, $bSecureLog);
|
||||
$this->validateResponse($mExpectCode, $sErrorPrefix);
|
||||
|
|
@ -641,10 +629,8 @@ class SmtpClient extends \MailSo\Net\NetClient
|
|||
|
||||
/**
|
||||
* @param string $sHost
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function ehloOrHelo($sHost)
|
||||
private function ehloOrHelo($sHost) : void
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -661,19 +647,15 @@ class SmtpClient extends \MailSo\Net\NetClient
|
|||
throw $oException;
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sHost
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws \MailSo\Net\Exceptions\Exception
|
||||
* @throws \MailSo\Smtp\Exceptions\Exception
|
||||
*/
|
||||
private function ehlo($sHost)
|
||||
private function ehlo($sHost) : void
|
||||
{
|
||||
$this->sendRequestWithCheck('EHLO', 250, $sHost);
|
||||
|
||||
|
|
@ -712,12 +694,10 @@ class SmtpClient extends \MailSo\Net\NetClient
|
|||
/**
|
||||
* @param string $sHost
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws \MailSo\Net\Exceptions\Exception
|
||||
* @throws \MailSo\Smtp\Exceptions\Exception
|
||||
*/
|
||||
private function helo($sHost)
|
||||
private function helo($sHost) : void
|
||||
{
|
||||
$this->sendRequestWithCheck('HELO', 250, $sHost);
|
||||
$this->aAuthTypes = array();
|
||||
|
|
@ -729,11 +709,9 @@ class SmtpClient extends \MailSo\Net\NetClient
|
|||
* @param int|array $mExpectCode
|
||||
* @param string $sErrorPrefix = ''
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws \MailSo\Smtp\Exceptions\ResponseException
|
||||
*/
|
||||
private function validateResponse($mExpectCode, $sErrorPrefix = '')
|
||||
private function validateResponse($mExpectCode, $sErrorPrefix = '') : void
|
||||
{
|
||||
if (!\is_array($mExpectCode))
|
||||
{
|
||||
|
|
@ -787,17 +765,4 @@ class SmtpClient extends \MailSo\Net\NetClient
|
|||
return 'SMTP';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \MailSo\Log\Logger $oLogger
|
||||
*
|
||||
* @return \MailSo\Smtp\SmtpClient
|
||||
*
|
||||
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
|
||||
*/
|
||||
public function SetLogger($oLogger)
|
||||
{
|
||||
parent::SetLogger($oLogger);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3293,12 +3293,8 @@ class Net_IDNA2
|
|||
*
|
||||
* @param array $input UCS4 sequence
|
||||
* @param boolean $include_bit Include bitmask in output
|
||||
*
|
||||
* @return void
|
||||
* @static
|
||||
* @access private
|
||||
*/
|
||||
private static function _showHex($input, $include_bit = false)
|
||||
private static function _showHex($input, $include_bit = false) : void
|
||||
{
|
||||
foreach ($input as $k => $v) {
|
||||
echo '[', $k, '] => ', sprintf('%X', $v);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue