All MailSo Exceptions to a more logical \MailSo\RuntimeException base

This commit is contained in:
the-djmaze 2022-10-24 10:49:57 +02:00
parent dc5ac7025d
commit c94e38b297
58 changed files with 436 additions and 558 deletions

View file

@ -1,19 +0,0 @@
<?php
/*
* This file is part of MailSo.
*
* (c) 2014 Usenko Timur
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace MailSo\Base\Exceptions;
/**
* @category MailSo
* @package Base
* @subpackage Exceptions
*/
class InvalidArgumentException extends \MailSo\Base\Exceptions\Exception {}

View file

@ -25,9 +25,10 @@ use MailSo\Imap\Enumerations\FolderResponseStatus;
trait Folders
{
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function FolderCreate(string $sFolderName) : self
{
@ -39,9 +40,10 @@ trait Folders
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function FolderDelete(string $sFolderName) : self
{
@ -63,9 +65,10 @@ trait Folders
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function FolderSubscribe(string $sFolderName) : self
{
@ -75,9 +78,10 @@ trait Folders
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function FolderUnsubscribe(string $sFolderName) : self
{
@ -87,9 +91,10 @@ trait Folders
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function FolderRename(string $sOldFolderName, string $sNewFolderName) : self
{
@ -100,9 +105,10 @@ trait Folders
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*
* https://datatracker.ietf.org/doc/html/rfc9051#section-6.3.11
*/
@ -169,8 +175,9 @@ trait Folders
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function FolderCheck() : self
{
@ -182,8 +189,9 @@ trait Folders
/**
* This also expunge the mailbox
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function FolderClose() : int
{
@ -197,8 +205,9 @@ trait Folders
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function FolderUnselect() : self
{
@ -225,8 +234,9 @@ trait Folders
* The EXPUNGE command permanently removes all messages that have the
* \Deleted flag set from the currently selected mailbox.
*
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function FolderExpunge(SequenceSet $oUidRange = null) : void
{
@ -246,8 +256,9 @@ trait Folders
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function FolderHierarchyDelimiter(string $sFolderName = '') : ?string
{
@ -256,9 +267,10 @@ trait Folders
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function FolderSelect(string $sFolderName, bool $bReSelectSameFolders = false) : FolderInformation
{
@ -271,9 +283,10 @@ trait Folders
* No changes to the permanent state of the mailbox, including per-user state,
* are permitted; in particular, EXAMINE MUST NOT cause messages to lose the \Recent flag.
*
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function FolderExamine(string $sFolderName, bool $bReSelectSameFolders = false) : FolderInformation
{
@ -281,9 +294,10 @@ trait Folders
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*
* REQUIRED IMAP4rev2 untagged responses: FLAGS, EXISTS, LIST
* REQUIRED IMAP4rev2 OK untagged responses: PERMANENTFLAGS, UIDNEXT, UIDVALIDITY
@ -300,7 +314,7 @@ trait Folders
if (!\strlen(\trim($sFolderName)))
{
throw new \MailSo\Base\Exceptions\InvalidArgumentException;
throw new \InvalidArgumentException;
}
$aSelectParams = array();
@ -374,8 +388,9 @@ trait Folders
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function FolderList(string $sParentFolderName, string $sListPattern, bool $bIsSubscribeList = false, bool $bUseListStatus = false) : array
{
@ -506,7 +521,7 @@ trait Folders
$aReturn[$sFullName] = $oFolder;
}
catch (\MailSo\Base\Exceptions\InvalidArgumentException $oException)
catch (\InvalidArgumentException $oException)
{
$this->writeLogException($oException, \LOG_WARNING, false);
}
@ -540,8 +555,9 @@ trait Folders
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function FolderSubscribeList(string $sParentFolderName, string $sListPattern) : array
{
@ -549,8 +565,9 @@ trait Folders
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function FolderStatusList(string $sParentFolderName, string $sListPattern) : array
{

View file

@ -17,7 +17,6 @@ use MailSo\Imap\Enumerations\FetchType;
use MailSo\Imap\ResponseCollection;
use MailSo\Imap\SequenceSet;
use MailSo\Imap\Enumerations\ResponseType;
use MailSo\Base\Exceptions\InvalidArgumentException;
/**
* @category MailSo
@ -26,15 +25,16 @@ use MailSo\Base\Exceptions\InvalidArgumentException;
trait Messages
{
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function Fetch(array $aInputFetchItems, string $sIndexRange, bool $bIndexIsUid) : array
{
if (!\strlen(\trim($sIndexRange)))
{
$this->writeLogException(new InvalidArgumentException, \LOG_ERR, true);
$this->writeLogException(new \InvalidArgumentException, \LOG_ERR, true);
}
$aReturn = array();
@ -130,9 +130,10 @@ trait Messages
*
* @param resource $rMessageAppendStream
*
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function MessageAppendStream(string $sFolderName, $rMessageAppendStream, int $iStreamSize, array $aFlagsList = null, int $iDateTime = 0) : ?int
{
@ -190,14 +191,15 @@ trait Messages
*/
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function MessageCopy(string $sToFolder, SequenceSet $oRange) : ResponseCollection
{
if (!\count($oRange)) {
$this->writeLogException(new InvalidArgumentException, \LOG_ERR, true);
$this->writeLogException(new \InvalidArgumentException, \LOG_ERR, true);
}
return $this->SendRequestGetResponse(
@ -207,19 +209,20 @@ trait Messages
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function MessageMove(string $sToFolder, SequenceSet $oRange) : ResponseCollection
{
if (!\count($oRange)) {
$this->writeLogException(new InvalidArgumentException, \LOG_ERR, true);
$this->writeLogException(new \InvalidArgumentException, \LOG_ERR, true);
}
if (!$this->IsSupported('MOVE')) {
$this->writeLogException(
new \MailSo\IMAP\Exceptions\RuntimeException('Move is not supported'),
new \MailSo\RuntimeException('Move is not supported'),
\LOG_ERR, true);
}
@ -236,9 +239,10 @@ trait Messages
*
* @param resource $rMessageStream
*
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function MessageReplaceStream(string $sFolderName, int $iUid, $rMessageStream, int $iStreamSize, array $aFlagsList = null, int $iDateTime = 0) : ?int
{
@ -279,9 +283,10 @@ trait Messages
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function MessageStoreFlag(SequenceSet $oRange, array $aInputStoreItems, string $sStoreAction) : ?ResponseCollection
{
@ -305,9 +310,10 @@ trait Messages
/**
* See https://tools.ietf.org/html/rfc5256
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function MessageSimpleSort(array $aSortTypes, string $sSearchCriterias = 'ALL', bool $bReturnUid = true) : array
{
@ -333,9 +339,10 @@ trait Messages
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function MessageSimpleESearch(string $sSearchCriterias = 'ALL', array $aSearchReturn = null, bool $bReturnUid = true, string $sCharset = '', string $sLimit = '') : array
{
@ -350,9 +357,10 @@ trait Messages
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function MessageSimpleESort(array $aSortTypes, string $sSearchCriterias = 'ALL', array $aSearchReturn = ['ALL'], bool $bReturnUid = true, string $sLimit = '') : array
{
@ -367,9 +375,10 @@ trait Messages
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function MessageSimpleSearch(string $sSearchCriterias = 'ALL', bool $bReturnUid = true, string $sCharset = '') : array
{
@ -416,9 +425,10 @@ trait Messages
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function MessageSimpleThread(string $sSearchCriterias = 'ALL', bool $bReturnUid = true) : iterable
{

View file

@ -23,8 +23,9 @@ trait Quota
/**
* https://datatracker.ietf.org/doc/html/rfc2087#section-4.2
*
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function Quota(string $sRootName = '') : ?array
{
@ -34,8 +35,9 @@ trait Quota
/**
* https://datatracker.ietf.org/doc/html/rfc2087#section-4.3
*
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function QuotaRoot(string $sFolderName = 'INBOX') : ?array
{

View file

@ -1,19 +0,0 @@
<?php
/*
* This file is part of MailSo.
*
* (c) 2014 Usenko Timur
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace MailSo\Imap\Exceptions;
/**
* @category MailSo
* @package Imap
* @subpackage Exceptions
*/
class Exception extends \MailSo\Base\Exceptions\Exception {}

View file

@ -16,7 +16,7 @@ namespace MailSo\Imap\Exceptions;
* @package Imap
* @subpackage Exceptions
*/
class ResponseException extends \MailSo\Imap\Exceptions\Exception
class ResponseException extends \MailSo\RuntimeException
{
/**
* @var array

View file

@ -16,4 +16,4 @@ namespace MailSo\Imap\Exceptions;
* @package Imap
* @subpackage Exceptions
*/
class ResponseNotFoundException extends \MailSo\Imap\Exceptions\Exception {}
class ResponseNotFoundException extends \MailSo\RuntimeException {}

View file

@ -1,19 +0,0 @@
<?php
/*
* This file is part of MailSo.
*
* (c) 2014 Usenko Timur
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace MailSo\Imap\Exceptions;
/**
* @category MailSo
* @package Imap
* @subpackage Exceptions
*/
class RuntimeException extends \MailSo\Imap\Exceptions\Exception {}

View file

@ -41,12 +41,12 @@ class Folder
private $aMetadata = array();
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \InvalidArgumentException
*/
function __construct(string $sFullName, string $sDelimiter = null, array $aFlags = array())
{
if (!\strlen($sFullName)) {
throw new \MailSo\Base\Exceptions\InvalidArgumentException;
throw new \InvalidArgumentException;
}
$this->sFullName = $sFullName;
$this->setDelimiter($sDelimiter);

View file

@ -80,9 +80,10 @@ class ImapClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function Connect(\MailSo\Net\ConnectSettings $oSettings) : void
{
@ -108,9 +109,10 @@ class ImapClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function Login(array $aCredentials) : self
{
@ -127,7 +129,7 @@ class ImapClient extends \MailSo\Net\NetClient
if (!\strlen($sLogin) || !\strlen($sPassword))
{
$this->writeLogException(
new \MailSo\Base\Exceptions\InvalidArgumentException,
new \InvalidArgumentException,
\LOG_ERR, true);
}
@ -141,7 +143,7 @@ class ImapClient extends \MailSo\Net\NetClient
}
}
if (!$type) {
throw new \Exception('No supported SASL mechanism found, remote server wants: '
throw new \MailSo\RuntimeException('No supported SASL mechanism found, remote server wants: '
. \implode(', ', \array_filter($this->Capability() ?: [], function($var){
return \str_starts_with($var, 'AUTH=');
}))
@ -263,7 +265,9 @@ class ImapClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function Logout() : void
{
@ -285,8 +289,9 @@ class ImapClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function Capability() : ?array
{
@ -319,8 +324,9 @@ class ImapClient extends \MailSo\Net\NetClient
* STARTTLS AUTH= LOGIN LOGINDISABLED QUOTA
* METADATA METADATA-SERVER
*
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function IsSupported(string $sExtentionName) : bool
{
@ -342,8 +348,9 @@ class ImapClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function GetNamespace() : ?NamespaceResult
{
@ -389,8 +396,9 @@ class ImapClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function Noop() : self
{
@ -399,8 +407,10 @@ class ImapClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function SendRequest(string $sCommand, array $aParams = array(), bool $bBreakOnLiteral = false) : string
{
@ -408,7 +418,7 @@ class ImapClient extends \MailSo\Net\NetClient
if (!\strlen($sCommand))
{
$this->writeLogException(
new \MailSo\Base\Exceptions\InvalidArgumentException,
new \InvalidArgumentException,
\LOG_ERR, true);
}
@ -455,9 +465,10 @@ class ImapClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function SendRequestGetResponse(string $sCommand, array $aParams = array()) : ResponseCollection
{
@ -487,9 +498,9 @@ class ImapClient extends \MailSo\Net\NetClient
* This will reduce CPU time on server and moves it to the client
* And can be used with the new JavaScript AbstractFetchRemote.streamPerLine(fCallback, sGetAdd)
*
* @throws \MailSo\Imap\Exceptions\ResponseNotFoundException
* @throws \MailSo\Imap\Exceptions\InvalidResponseException
* @throws \MailSo\Imap\Exceptions\NegativeResponseException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
protected function streamResponse(string $sEndTag = null) : void
{

View file

@ -12,8 +12,6 @@
namespace MailSo\Imap\Requests;
use MailSo\Imap\Exceptions\RuntimeException;
/**
* @category MailSo
* @package Imap
@ -56,7 +54,7 @@ class ESEARCH extends Request
{
if (!$oImapClient->IsSupported('ESEARCH')) {
$oImapClient->writeLogException(
new RuntimeException('ESEARCH is not supported'),
new \MailSo\RuntimeException('ESEARCH is not supported'),
\LOG_ERR, true);
}
parent::__construct($oImapClient);
@ -70,7 +68,7 @@ class ESEARCH extends Request
/* // RFC 6203
if (false !== \stripos($this->sCriterias, 'FUZZY') && !$this->oImapClient->IsSupported('SEARCH=FUZZY')) {
$this->oImapClient->writeLogException(
new RuntimeException('SEARCH=FUZZY is not supported'),
new \MailSo\RuntimeException('SEARCH=FUZZY is not supported'),
\LOG_ERR, true);
}
*/
@ -91,7 +89,7 @@ class ESEARCH extends Request
if ($aFolders) {
if (!$this->oImapClient->IsSupported('MULTISEARCH')) {
$this->oImapClient->writeLogException(
new RuntimeException('MULTISEARCH is not supported'),
new \MailSo\RuntimeException('MULTISEARCH is not supported'),
\LOG_ERR, true);
}
$sCmd = 'ESEARCH';
@ -111,7 +109,7 @@ class ESEARCH extends Request
foreach ($this->aReturn as $sReturn) {
if (\preg_match('/PARTIAL|UPDATE|CONTEXT/i', $sReturn)) {
$this->oImapClient->writeLogException(
new RuntimeException('CONTEXT=SEARCH is not supported'),
new \MailSo\RuntimeException('CONTEXT=SEARCH is not supported'),
\LOG_ERR, true);
}
}

View file

@ -15,8 +15,6 @@
namespace MailSo\Imap\Requests;
use MailSo\Imap\Exceptions\RuntimeException;
/**
* @category MailSo
* @package Imap
@ -57,7 +55,7 @@ class SORT extends Request
{
if (!$oImapClient->IsSupported('SORT')) {
$oImapClient->writeLogException(
new RuntimeException('SORT is not supported'),
new \MailSo\RuntimeException('SORT is not supported'),
\LOG_ERR, true);
}
parent::__construct($oImapClient);
@ -67,7 +65,7 @@ class SORT extends Request
{
if (!$this->aSortTypes) {
$this->oImapClient->writeLogException(
new RuntimeException('SortTypes are missing'),
new \MailSo\RuntimeException('SortTypes are missing'),
\LOG_ERR, true);
}
@ -77,14 +75,14 @@ class SORT extends Request
// RFC 5267 checks
if (!$this->oImapClient->IsSupported('ESORT')) {
$this->oImapClient->writeLogException(
new RuntimeException('ESORT is not supported'),
new \MailSo\RuntimeException('ESORT is not supported'),
\LOG_ERR, true);
}
if (!$this->oImapClient->IsSupported('CONTEXT=SORT')) {
foreach ($this->aReturn as $sReturn) {
if (\preg_match('/PARTIAL|UPDATE|CONTEXT/i', $sReturn)) {
$this->oImapClient->writeLogException(
new RuntimeException('CONTEXT=SORT is not supported'),
new \MailSo\RuntimeException('CONTEXT=SORT is not supported'),
\LOG_ERR, true);
}
}

View file

@ -35,7 +35,7 @@ class THREAD extends Request
$this->sAlgorithm = 'ORDEREDSUBJECT';
} else {
$oImapClient->writeLogException(
new \MailSo\Imap\Exceptions\RuntimeException('THREAD is not supported'),
new \MailSo\RuntimeException('THREAD is not supported'),
\LOG_ERR, true);
}
parent::__construct($oImapClient);
@ -45,7 +45,7 @@ class THREAD extends Request
{
if (!$this->oImapClient->IsSupported(\strtoupper("THREAD={$this->sAlgorithm}"))) {
$this->oImapClient->writeLogException(
new \MailSo\Imap\Exceptions\RuntimeException("THREAD={$this->sAlgorithm} is not supported"),
new \MailSo\RuntimeException("THREAD={$this->sAlgorithm} is not supported"),
\LOG_ERR, true);
}

View file

@ -68,7 +68,9 @@ trait ResponseParser
/**
* @return array|string
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
private function partialParseResponseBranch(Response $oImapResponse,
bool $bTreatAsAtom,

View file

@ -1,19 +0,0 @@
<?php
/*
* This file is part of MailSo.
*
* (c) 2014 Usenko Timur
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace MailSo\Mail\Exceptions;
/**
* @category MailSo
* @package Mail
* @subpackage Exceptions
*/
class Exception extends \MailSo\Base\Exceptions\Exception {}

View file

@ -16,4 +16,4 @@ namespace MailSo\Mail\Exceptions;
* @package Mail
* @subpackage Exceptions
*/
class NonEmptyFolder extends \MailSo\Mail\Exceptions\RuntimeException {}
class NonEmptyFolder extends \MailSo\RuntimeException {}

View file

@ -1,19 +0,0 @@
<?php
/*
* This file is part of MailSo.
*
* (c) 2014 Usenko Timur
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace MailSo\Mail\Exceptions;
/**
* @category MailSo
* @package Mail
* @subpackage Exceptions
*/
class RuntimeException extends \MailSo\Mail\Exceptions\Exception {}

View file

@ -36,7 +36,7 @@ class Folder implements \JsonSerializable
private $oImapFolder;
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \InvalidArgumentException
*/
function __construct(\MailSo\Imap\Folder $oImapFolder, bool $bSubscribed = true, bool $bExists = true)
{
@ -46,8 +46,8 @@ class Folder implements \JsonSerializable
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \InvalidArgumentException
* @throws \InvalidArgumentException
*/
public static function NewNonExistentInstance(string $sFullName, string $sDelimiter) : self
{

View file

@ -49,7 +49,8 @@ class MailClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
*/
public function Disconnect() : self
{
@ -123,10 +124,11 @@ class MailClient
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \MailSo\Mail\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
* @throws \MailSo\Mail\Exceptions\*
*/
public function MessageSetFlag(string $sFolderName, SequenceSet $oRange, string $sMessageFlag, bool $bSetAction = true, bool $bSkipUnsupportedFlag = false) : void
{
@ -135,21 +137,22 @@ class MailClient
$sStoreAction = $bSetAction ? StoreAction::ADD_FLAGS_SILENT : StoreAction::REMOVE_FLAGS_SILENT;
$this->oImapClient->MessageStoreFlag($oRange, array($sMessageFlag), $sStoreAction);
} else if (!$bSkipUnsupportedFlag) {
throw new Exceptions\RuntimeException('Message flag "'.$sMessageFlag.'" is not supported.');
throw new \MailSo\RuntimeException('Message flag "'.$sMessageFlag.'" is not supported.');
}
}
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function Message(string $sFolderName, int $iIndex, bool $bIndexIsUid = true, ?\MailSo\Cache\CacheClient $oCacher = null, int $iBodyTextLimit = 0) : ?Message
{
if (!\MailSo\Base\Validator::RangeInt($iIndex, 1))
{
throw new \MailSo\Base\Exceptions\InvalidArgumentException;
throw new \InvalidArgumentException;
}
$this->oImapClient->FolderExamine($sFolderName);
@ -216,15 +219,16 @@ class MailClient
*
* @param mixed $mCallback
*
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function MessageMimeStream($mCallback, string $sFolderName, int $iIndex, string $sMimeIndex) : bool
{
if (!\is_callable($mCallback))
{
throw new \MailSo\Base\Exceptions\InvalidArgumentException;
throw new \InvalidArgumentException;
}
$this->oImapClient->FolderExamine($sFolderName);
@ -303,15 +307,16 @@ class MailClient
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function MessageDelete(string $sFolder, SequenceSet $oRange, bool $bExpungeAll = false) : self
{
if (!\strlen($sFolder) || !\count($oRange))
{
throw new \MailSo\Base\Exceptions\InvalidArgumentException;
throw new \InvalidArgumentException;
}
$this->oImapClient->FolderSelect($sFolder);
@ -331,15 +336,16 @@ class MailClient
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function MessageMove(string $sFromFolder, string $sToFolder, SequenceSet $oRange, bool $bUseMoveSupported = true, bool $bExpungeAll = false) : self
{
if (!$sFromFolder || !$sToFolder || !\count($oRange))
{
throw new \MailSo\Base\Exceptions\InvalidArgumentException;
throw new \InvalidArgumentException;
}
$this->oImapClient->FolderSelect($sFromFolder);
@ -359,15 +365,16 @@ class MailClient
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function MessageCopy(string $sFromFolder, string $sToFolder, SequenceSet $oRange) : self
{
if (!$sFromFolder || !$sToFolder || !\count($oRange))
{
throw new \MailSo\Base\Exceptions\InvalidArgumentException;
throw new \InvalidArgumentException;
}
$this->oImapClient->FolderSelect($sFromFolder);
@ -377,8 +384,9 @@ class MailClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function FolderUnselect() : self
{
@ -397,7 +405,7 @@ class MailClient
{
if (!\is_resource($rMessageStream) || !\strlen($sFolderToSave))
{
throw new \MailSo\Base\Exceptions\InvalidArgumentException;
throw new \InvalidArgumentException;
}
$iUid = $this->oImapClient->MessageAppendStream(
@ -410,7 +418,7 @@ class MailClient
{
if (!\is_file($sMessageFileName) || !\is_readable($sMessageFileName))
{
throw new \MailSo\Base\Exceptions\InvalidArgumentException;
throw new \InvalidArgumentException;
}
$iMessageStreamSize = \filesize($sMessageFileName);
@ -513,9 +521,10 @@ class MailClient
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function FolderInformation(string $sFolderName, int $iPrevUidNext = 0, SequenceSet $oRange = null) : array
{
@ -563,9 +572,10 @@ class MailClient
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function FolderHash(string $sFolderName) : string
{
@ -575,9 +585,10 @@ class MailClient
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function MessageListThreadsMap(string $sFolderName, string $sFolderHash, ?\MailSo\Cache\CacheClient $oCacher) : array
{
@ -633,7 +644,7 @@ class MailClient
$aResult[] = $aMap;
}
}
catch (\MailSo\Imap\Exceptions\RuntimeException $oException)
catch (\MailSo\RuntimeException $oException)
{
\SnappyMail\Log::warning('MessageListThreadsMap ' . $oException->getMessage());
unset($oException);
@ -655,8 +666,9 @@ class MailClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
protected function MessageListByRequestIndexOrUids(MessageCollection $oMessageCollection, SequenceSet $oRange) : void
{
@ -686,7 +698,8 @@ class MailClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
*/
public function IsThreadsSupported() : bool
{
@ -696,9 +709,10 @@ class MailClient
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
private function GetUids(MessageListParams $oParams, string $sSearch,
string $sFolderName, string $sFolderHash,
@ -810,16 +824,17 @@ class MailClient
/**
* Runs SORT/SEARCH when $sSearch is provided
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\Exceptions\*
*/
public function MessageList(MessageListParams $oParams) : MessageCollection
{
if (!\MailSo\Base\Validator::RangeInt($oParams->iOffset, 0) ||
!\MailSo\Base\Validator::RangeInt($oParams->iLimit, 0, 999))
{
throw new \MailSo\Base\Exceptions\InvalidArgumentException;
throw new \InvalidArgumentException;
}
$sSearch = \trim($oParams->sSearch);
@ -850,7 +865,7 @@ class MailClient
if ($oParams->iThreadUid && !$bUseThreads)
{
throw new \MailSo\Base\Exceptions\InvalidArgumentException('THREAD not supported');
throw new \InvalidArgumentException('THREAD not supported');
}
if (!$oParams->oCacher || !($oParams->oCacher instanceof \MailSo\Cache\CacheClient))
@ -1015,7 +1030,7 @@ class MailClient
{
if (!\strlen($sMessageId))
{
throw new \MailSo\Base\Exceptions\InvalidArgumentException;
throw new \InvalidArgumentException;
}
$this->oImapClient->FolderExamine($sFolderName);
@ -1097,7 +1112,7 @@ class MailClient
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \InvalidArgumentException
*/
public function FolderCreate(string $sFolderNameInUtf8, string $sFolderParentFullName = '', bool $bSubscribeOnCreation = true, string $sDelimiter = '') : ?Folder
{
@ -1106,7 +1121,7 @@ class MailClient
if (!\strlen($sFolderNameInUtf8))
{
throw new \MailSo\Base\Exceptions\InvalidArgumentException;
throw new \InvalidArgumentException;
}
if (!\strlen($sDelimiter) || \strlen($sFolderParentFullName))
@ -1115,7 +1130,7 @@ class MailClient
if (null === $sDelimiter)
{
// TODO: Translate
throw new Exceptions\RuntimeException(
throw new \MailSo\RuntimeException(
\strlen($sFolderParentFullName)
? 'Cannot create folder in non-existent parent folder.'
: 'Cannot get folder delimiter.');
@ -1130,7 +1145,7 @@ class MailClient
if (\strlen($sDelimiter) && false !== \strpos($sFolderNameInUtf8, $sDelimiter))
{
// TODO: Translate
throw new Exceptions\RuntimeException(
throw new \MailSo\RuntimeException(
'New folder name contains delimiter.');
}
@ -1151,31 +1166,31 @@ class MailClient
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \InvalidArgumentException
*/
public function FolderMove(string $sPrevFolderFullName, string $sNextFolderFullNameInUtf, bool $bSubscribeOnMove = true) : self
{
if (!$this->oImapClient->FolderHierarchyDelimiter($sPrevFolderFullName)) {
// TODO: Translate
throw new Exceptions\RuntimeException('Cannot move non-existent folder.');
throw new \MailSo\RuntimeException('Cannot move non-existent folder.');
}
return $this->folderModify($sPrevFolderFullName, $sNextFolderFullNameInUtf, $bSubscribeOnMove);
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \InvalidArgumentException
*/
public function FolderRename(string $sPrevFolderFullName, string $sNewTopFolderNameInUtf, bool $bSubscribeOnRename = true) : string
{
$sDelimiter = $this->oImapClient->FolderHierarchyDelimiter($sPrevFolderFullName);
if (!$sDelimiter) {
// TODO: Translate
throw new Exceptions\RuntimeException('Cannot rename non-existent folder.');
throw new \MailSo\RuntimeException('Cannot rename non-existent folder.');
}
if (\strlen($sDelimiter) && false !== \strpos($sNewTopFolderNameInUtf, $sDelimiter)) {
// TODO: Translate
throw new Exceptions\RuntimeException('New folder name contains delimiter.');
throw new \MailSo\RuntimeException('New folder name contains delimiter.');
}
$iLast = \strrpos($sPrevFolderFullName, $sDelimiter);
@ -1188,14 +1203,14 @@ class MailClient
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Base\Exceptions\RuntimeException
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
*/
protected function folderModify(string $sPrevFolderFullName, string $sNewFolderFullName, bool $bSubscribe) : self
{
if (!\strlen($sPrevFolderFullName) || !\strlen($sNewFolderFullName))
{
throw new \MailSo\Base\Exceptions\InvalidArgumentException;
throw new \InvalidArgumentException;
}
$aSubscribeFolders = array();
@ -1226,13 +1241,13 @@ class MailClient
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Mail\Exceptions\RuntimeException
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
*/
public function FolderDelete(string $sFolderFullName) : self
{
if (!\strlen($sFolderFullName) || 'INBOX' === $sFolderFullName) {
throw new \MailSo\Base\Exceptions\InvalidArgumentException;
throw new \InvalidArgumentException;
}
if ($this->oImapClient->IsSupported('IMAP4rev2')) {
@ -1253,7 +1268,7 @@ class MailClient
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \InvalidArgumentException
*/
public function FolderClear(string $sFolderFullName) : self
{
@ -1268,25 +1283,25 @@ class MailClient
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \InvalidArgumentException
*/
public function FolderSubscribe(string $sFolderFullName, bool $bSubscribe) : self
{
if (!\strlen($sFolderFullName)) {
throw new \MailSo\Base\Exceptions\InvalidArgumentException;
throw new \InvalidArgumentException;
}
$this->oImapClient->{$bSubscribe ? 'FolderSubscribe' : 'FolderUnsubscribe'}($sFolderFullName);
return $this;
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \InvalidArgumentException
*/
public function SetLogger(\MailSo\Log\Logger $oLogger) : self
{
if (!($oLogger instanceof \MailSo\Log\Logger))
{
throw new \MailSo\Base\Exceptions\InvalidArgumentException;
throw new \InvalidArgumentException;
}
$this->oLogger = $oLogger;

View file

@ -38,13 +38,13 @@ class Email implements \JsonSerializable
private $sDkimValue;
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \InvalidArgumentException
*/
function __construct(string $sEmail, string $sDisplayName = '')
{
if (!\strlen(\trim($sEmail)))
{
throw new \MailSo\Base\Exceptions\InvalidArgumentException;
throw new \InvalidArgumentException;
}
$this->sEmail = \MailSo\Base\Utils::IdnToAscii(
@ -57,14 +57,14 @@ class Email implements \JsonSerializable
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \InvalidArgumentException
*/
public static function Parse(string $sEmailAddress) : self
{
$sEmailAddress = \MailSo\Base\Utils::Trim($sEmailAddress);
if (!\strlen(\trim($sEmailAddress)))
{
throw new \MailSo\Base\Exceptions\InvalidArgumentException;
throw new \InvalidArgumentException;
}
$sName = '';

View file

@ -165,7 +165,7 @@ class EmailCollection extends \MailSo\Base\Collection
$iEmailStartPos = $iCurrentPos + 1;
}
catch (\MailSo\Base\Exceptions\InvalidArgumentException $oException)
catch (\InvalidArgumentException $oException)
{
}
}
@ -183,7 +183,7 @@ class EmailCollection extends \MailSo\Base\Collection
Email::Parse(\substr($sRawEmails, $iEmailStartPos, $iCurrentPos - $iEmailStartPos))
);
}
catch (\MailSo\Base\Exceptions\InvalidArgumentException $oException) {}
catch (\InvalidArgumentException $oException) {}
}
}
}

View file

@ -16,4 +16,4 @@ namespace MailSo\Net\Exceptions;
* @package Net
* @subpackage Exceptions
*/
class ConnectionException extends \MailSo\Net\Exceptions\Exception {}
class ConnectionException extends \MailSo\RuntimeException {}

View file

@ -1,19 +0,0 @@
<?php
/*
* This file is part of MailSo.
*
* (c) 2014 Usenko Timur
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace MailSo\Net\Exceptions;
/**
* @category MailSo
* @package Net
* @subpackage Exceptions
*/
class Exception extends \MailSo\Base\Exceptions\Exception {}

View file

@ -1,19 +0,0 @@
<?php
/*
* This file is part of MailSo.
*
* (c) 2014 Usenko Timur
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace MailSo\Net\Exceptions;
/**
* @category MailSo
* @package Net
* @subpackage Exceptions
*/
class InvalidArgumentException extends \MailSo\Net\Exceptions\Exception {}

View file

@ -16,4 +16,4 @@ namespace MailSo\Net\Exceptions;
* @package Net
* @subpackage Exceptions
*/
class SocketAlreadyConnectedException extends \MailSo\Net\Exceptions\ConnectionException {}
class SocketAlreadyConnectedException extends ConnectionException {}

View file

@ -16,7 +16,7 @@ namespace MailSo\Net\Exceptions;
* @package Net
* @subpackage Exceptions
*/
class SocketCanNotConnectToHostException extends \MailSo\Net\Exceptions\ConnectionException
class SocketCanNotConnectToHostException extends ConnectionException
{
/**
* @var string

View file

@ -16,4 +16,4 @@ namespace MailSo\Net\Exceptions;
* @package Net
* @subpackage Exceptions
*/
class SocketConnectionDoesNotAvailableException extends \MailSo\Net\Exceptions\ConnectionException {}
class SocketConnectionDoesNotAvailableException extends ConnectionException {}

View file

@ -16,4 +16,4 @@ namespace MailSo\Net\Exceptions;
* @package Net
* @subpackage Exceptions
*/
class SocketReadException extends \MailSo\Net\Exceptions\Exception {}
class SocketReadException extends \MailSo\RuntimeException {}

View file

@ -16,4 +16,4 @@ namespace MailSo\Net\Exceptions;
* @package Net
* @subpackage Exceptions
*/
class SocketReadTimeoutException extends \MailSo\Net\Exceptions\Exception {}
class SocketReadTimeoutException extends \MailSo\RuntimeException {}

View file

@ -16,4 +16,4 @@ namespace MailSo\Net\Exceptions;
* @package Net
* @subpackage Exceptions
*/
class SocketUnreadBufferException extends \MailSo\Net\Exceptions\Exception {}
class SocketUnreadBufferException extends \MailSo\RuntimeException {}

View file

@ -16,4 +16,4 @@ namespace MailSo\Net\Exceptions;
* @package Net
* @subpackage Exceptions
*/
class SocketUnsuppoterdSecureConnectionException extends \MailSo\Net\Exceptions\ConnectionException {}
class SocketUnsuppoterdSecureConnectionException extends ConnectionException {}

View file

@ -16,4 +16,4 @@ namespace MailSo\Net\Exceptions;
* @package Net
* @subpackage Exceptions
*/
class SocketWriteException extends \MailSo\Net\Exceptions\Exception {}
class SocketWriteException extends \MailSo\RuntimeException {}

View file

@ -112,10 +112,11 @@ abstract class NetClient
public function capturePhpErrorWithException(int $iErrNo, string $sErrStr, string $sErrFile, int $iErrLine) : bool
{
throw new \MailSo\Base\Exceptions\Exception($sErrStr, $iErrNo);
throw new \MailSo\RuntimeException($sErrStr, $iErrNo);
}
/**
* @throws \MailSo\RuntimeException
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\SocketAlreadyConnectedException
* @throws \MailSo\Net\Exceptions\SocketCanNotConnectToHostException
@ -226,13 +227,14 @@ abstract class NetClient
if ($bError) {
$this->writeLogException(
new \MailSo\Net\Exceptions\Exception('Cannot enable STARTTLS.'),
new \MailSo\RuntimeException('Cannot enable STARTTLS.'),
\LOG_ERR, true);
}
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
*/
public function Disconnect() : void
{

View file

@ -9,20 +9,20 @@
* file that was distributed with this source code.
*/
namespace MailSo\Base\Exceptions;
namespace MailSo;
/**
* @category MailSo
* @package Base
* @subpackage Exceptions
*/
class Exception extends \Exception
class RuntimeException extends \RuntimeException
{
public function __construct(string $sMessage = '', int $iCode = 0, \Throwable $oPrevious = null)
/*
public function __construct(string $sMessage = '', int $iCode = 0, ?\Throwable $oPrevious = null)
{
$sMessage = \strlen($sMessage) ? $sMessage
: \str_replace('\\', '-', \get_class($this)).' ('.\basename($this->getFile()).' ~ '.$this->getLine().')';
: \str_replace('\\', '-', \get_class($this)).' ('.\basename($this->getFile()).'#'.$this->getLine().')';
parent::__construct($sMessage, $iCode, $oPrevious);
}
*/
}

View file

@ -1,19 +0,0 @@
<?php
/*
* This file is part of MailSo.
*
* (c) 2014 Usenko Timur
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace MailSo\Sieve\Exceptions;
/**
* @category MailSo
* @package Sieve
* @subpackage Exceptions
*/
class Exception extends \MailSo\Base\Exceptions\Exception {}

View file

@ -16,4 +16,4 @@ namespace MailSo\Sieve\Exceptions;
* @package Sieve
* @subpackage Exceptions
*/
class LoginBadCredentialsException extends \MailSo\Sieve\Exceptions\LoginException {}
class LoginBadCredentialsException extends LoginException {}

View file

@ -16,4 +16,4 @@ namespace MailSo\Sieve\Exceptions;
* @package Sieve
* @subpackage Exceptions
*/
class LoginBadMethodException extends \MailSo\Sieve\Exceptions\LoginException {}
class LoginBadMethodException extends LoginException {}

View file

@ -16,4 +16,4 @@ namespace MailSo\Sieve\Exceptions;
* @package Sieve
* @subpackage Exceptions
*/
class LoginException extends \MailSo\Sieve\Exceptions\NegativeResponseException {}
class LoginException extends NegativeResponseException {}

View file

@ -16,4 +16,4 @@ namespace MailSo\Sieve\Exceptions;
* @package Sieve
* @subpackage Exceptions
*/
class NegativeResponseException extends \MailSo\Sieve\Exceptions\ResponseException {}
class NegativeResponseException extends ResponseException {}

View file

@ -16,7 +16,7 @@ namespace MailSo\Sieve\Exceptions;
* @package Sieve
* @subpackage Exceptions
*/
class ResponseException extends \MailSo\Sieve\Exceptions\Exception
class ResponseException extends \MailSo\RuntimeException
{
/**
* @var array

View file

@ -1,19 +0,0 @@
<?php
/*
* This file is part of MailSo.
*
* (c) 2014 Usenko Timur
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace MailSo\Sieve\Exceptions;
/**
* @category MailSo
* @package Sieve
* @subpackage Exceptions
*/
class RuntimeException extends \MailSo\Sieve\Exceptions\Exception {}

View file

@ -58,9 +58,10 @@ class ManageSieveClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Sieve\Exceptions\ResponseException
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Sieve\Exceptions\*
*/
public function Connect(\MailSo\Net\ConnectSettings $oSettings) : void
{
@ -88,9 +89,10 @@ class ManageSieveClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Sieve\Exceptions\LoginException
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Sieve\Exceptions\*
*/
public function Login(array $aCredentials) : self
{
@ -100,7 +102,7 @@ class ManageSieveClient extends \MailSo\Net\NetClient
if (!\strlen($sLogin) || !\strlen($sPassword))
{
$this->writeLogException(
new \MailSo\Base\Exceptions\InvalidArgumentException,
new \InvalidArgumentException,
\LOG_ERR, true);
}
@ -199,8 +201,9 @@ class ManageSieveClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Sieve\Exceptions\NegativeResponseException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Sieve\Exceptions\*
*/
public function Logout() : void
{
@ -212,8 +215,9 @@ class ManageSieveClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Sieve\Exceptions\NegativeResponseException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Sieve\Exceptions\*
*/
public function ListScripts() : array
{
@ -237,8 +241,9 @@ class ManageSieveClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Sieve\Exceptions\NegativeResponseException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Sieve\Exceptions\*
*/
public function Capability() : array
{
@ -251,8 +256,9 @@ class ManageSieveClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Sieve\Exceptions\NegativeResponseException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Sieve\Exceptions\*
*/
public function Noop() : self
{
@ -262,8 +268,9 @@ class ManageSieveClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Sieve\Exceptions\NegativeResponseException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Sieve\Exceptions\*
*/
public function GetScript(string $sScriptName) : string
{
@ -291,8 +298,9 @@ class ManageSieveClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Sieve\Exceptions\NegativeResponseException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Sieve\Exceptions\*
*/
public function PutScript(string $sScriptName, string $sScriptSource) : self
{
@ -304,8 +312,9 @@ class ManageSieveClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Sieve\Exceptions\NegativeResponseException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Sieve\Exceptions\*
*/
public function CheckScript(string $sScriptSource) : self
{
@ -317,8 +326,9 @@ class ManageSieveClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Sieve\Exceptions\NegativeResponseException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Sieve\Exceptions\*
*/
public function SetActiveScript(string $sScriptName) : self
{
@ -328,8 +338,9 @@ class ManageSieveClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Sieve\Exceptions\NegativeResponseException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Sieve\Exceptions\*
*/
public function DeleteScript(string $sScriptName) : self
{
@ -339,8 +350,9 @@ class ManageSieveClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Sieve\Exceptions\NegativeResponseException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Sieve\Exceptions\*
*/
public function RenameScript(string $sOldName, string $sNewName) : self
{
@ -350,8 +362,9 @@ class ManageSieveClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Sieve\Exceptions\NegativeResponseException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Sieve\Exceptions\*
*/
public function GetActiveScriptName() : string
{
@ -368,8 +381,9 @@ class ManageSieveClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Sieve\Exceptions\NegativeResponseException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Sieve\Exceptions\*
*/
public function IsActiveScript(string $sScriptName) : bool
{
@ -407,8 +421,9 @@ class ManageSieveClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
*/
private function parseStartupResponse(array $aResponse) : void
{
@ -440,15 +455,16 @@ class ManageSieveClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
*/
private function sendRequest(string $sRequest) : void
{
if (!\strlen(\trim($sRequest)))
{
$this->writeLogException(
new \MailSo\Base\Exceptions\InvalidArgumentException,
new \InvalidArgumentException,
\LOG_ERR, true);
}
@ -458,8 +474,9 @@ class ManageSieveClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Sieve\Exceptions\NegativeResponseException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Sieve\Exceptions\*
*/
private function sendRequestWithCheck(string $sRequest) : void
{

View file

@ -1,19 +0,0 @@
<?php
/*
* This file is part of MailSo.
*
* (c) 2014 Usenko Timur
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace MailSo\Smtp\Exceptions;
/**
* @category MailSo
* @package Smtp
* @subpackage Exceptions
*/
class Exception extends \MailSo\Base\Exceptions\Exception {}

View file

@ -16,4 +16,4 @@ namespace MailSo\Smtp\Exceptions;
* @package Smtp
* @subpackage Exceptions
*/
class LoginBadCredentialsException extends \MailSo\Smtp\Exceptions\LoginException {}
class LoginBadCredentialsException extends LoginException {}

View file

@ -16,4 +16,4 @@ namespace MailSo\Smtp\Exceptions;
* @package Smtp
* @subpackage Exceptions
*/
class LoginBadMethodException extends \MailSo\Smtp\Exceptions\LoginException {}
class LoginBadMethodException extends LoginException {}

View file

@ -16,4 +16,4 @@ namespace MailSo\Smtp\Exceptions;
* @package Smtp
* @subpackage Exceptions
*/
class LoginException extends \MailSo\Smtp\Exceptions\NegativeResponseException {}
class LoginException extends NegativeResponseException {}

View file

@ -16,4 +16,4 @@ namespace MailSo\Smtp\Exceptions;
* @package Smtp
* @subpackage Exceptions
*/
class NegativeResponseException extends \MailSo\Smtp\Exceptions\ResponseException {}
class NegativeResponseException extends ResponseException {}

View file

@ -16,7 +16,7 @@ namespace MailSo\Smtp\Exceptions;
* @package Smtp
* @subpackage Exceptions
*/
class ResponseException extends \MailSo\Smtp\Exceptions\Exception
class ResponseException extends \MailSo\RuntimeException
{
/**
* @var array

View file

@ -1,19 +0,0 @@
<?php
/*
* This file is part of MailSo.
*
* (c) 2014 Usenko Timur
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace MailSo\Smtp\Exceptions;
/**
* @category MailSo
* @package Smtp
* @subpackage Exceptions
*/
class RuntimeException extends \MailSo\Smtp\Exceptions\Exception {}

View file

@ -96,9 +96,10 @@ class SmtpClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Smtp\Exceptions\ResponseException
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Smtp\Exceptions\*
*/
public function Connect(\MailSo\Net\ConnectSettings $oSettings, string $sEhloHost = '[127.0.0.1]') : void
{
@ -110,9 +111,10 @@ class SmtpClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Smtp\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\*
* @throws \MailSo\Smtp\Exceptions\*
*/
public function Login(array $aCredentials) : self
{
@ -197,8 +199,9 @@ class SmtpClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Smtp\Exceptions\Exception
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Smtp\Exceptions\*
*/
public function MailFrom(string $sFrom, string $sSizeIfSupported = '', bool $bDsn = false) : self
{
@ -227,15 +230,16 @@ class SmtpClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Smtp\Exceptions\Exception
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Smtp\Exceptions\*
*/
public function Rcpt(string $sTo, bool $bDsn = false) : self
{
if (!$this->bMail)
{
$this->writeLogException(
new Exceptions\RuntimeException('No sender reverse path has been supplied'),
new \MailSo\RuntimeException('No sender reverse path has been supplied'),
\LOG_ERR, true);
}
@ -260,8 +264,9 @@ class SmtpClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Smtp\Exceptions\Exception
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Smtp\Exceptions\*
*/
public function MailTo(string $sTo) : self
{
@ -269,14 +274,15 @@ class SmtpClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Smtp\Exceptions\Exception
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Smtp\Exceptions\*
*/
public function Data(string $sData) : self
{
if (!\strlen(\trim($sData)))
{
throw new \MailSo\Base\Exceptions\InvalidArgumentException;
throw new \InvalidArgumentException;
}
$rDataStream = \MailSo\Base\ResourceRegistry::CreateMemoryResourceFromString($sData);
@ -290,21 +296,22 @@ class SmtpClient extends \MailSo\Net\NetClient
/**
* @param resource $rDataStream
*
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Smtp\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Smtp\Exceptions\*
*/
public function DataWithStream($rDataStream) : self
{
if (!\is_resource($rDataStream))
{
throw new \MailSo\Base\Exceptions\InvalidArgumentException;
throw new \InvalidArgumentException;
}
if (!$this->bRcpt)
{
$this->writeLogException(
new Exceptions\RuntimeException('No recipient forward path has been supplied'),
new \MailSo\RuntimeException('No recipient forward path has been supplied'),
\LOG_ERR, true);
}
@ -332,7 +339,7 @@ class SmtpClient extends \MailSo\Net\NetClient
else if (!\feof($rDataStream))
{
$this->writeLogException(
new Exceptions\RuntimeException('Cannot read input resource'),
new \MailSo\RuntimeException('Cannot read input resource'),
\LOG_ERR, true);
}
@ -349,8 +356,9 @@ class SmtpClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Smtp\Exceptions\Exception
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Smtp\Exceptions\*
*/
public function Rset() : self
{
@ -364,8 +372,9 @@ class SmtpClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Smtp\Exceptions\Exception
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Smtp\Exceptions\*
*/
public function Vrfy(string $sUser) : self
{
@ -378,8 +387,9 @@ class SmtpClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Smtp\Exceptions\Exception
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Smtp\Exceptions\*
*/
public function Noop() : self
{
@ -389,8 +399,9 @@ class SmtpClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Smtp\Exceptions\Exception
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Smtp\Exceptions\*
*/
public function Logout() : void
{
@ -410,7 +421,7 @@ class SmtpClient extends \MailSo\Net\NetClient
if ($this->bHelo)
{
$this->writeLogException(
new Exceptions\RuntimeException('Cannot issue EHLO/HELO to existing session'),
new \MailSo\RuntimeException('Cannot issue EHLO/HELO to existing session'),
\LOG_ERR, true);
}
@ -434,15 +445,16 @@ class SmtpClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
*/
private function sendRequest(string $sCommand, string $sAddToCommand = '', bool $bSecureLog = false) : void
{
if (!\strlen(\trim($sCommand)))
{
$this->writeLogException(
new \MailSo\Base\Exceptions\InvalidArgumentException,
new \InvalidArgumentException,
\LOG_ERR, true);
}
@ -457,9 +469,10 @@ class SmtpClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Smtp\Exceptions\Exception
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Smtp\Exceptions\*
*/
private function sendRequestWithCheck(string $sCommand, $mExpectCode, string $sAddToCommand = '', bool $bSecureLog = false, string $sErrorPrefix = '') : string
{
@ -488,8 +501,9 @@ class SmtpClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Smtp\Exceptions\Exception
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Smtp\Exceptions\*
*/
private function ehlo(string $sHost) : void
{
@ -528,8 +542,9 @@ class SmtpClient extends \MailSo\Net\NetClient
}
/**
* @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Smtp\Exceptions\Exception
* @throws \MailSo\RuntimeException
* @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Smtp\Exceptions\*
*/
private function helo(string $sHost) : void
{

View file

@ -70,7 +70,7 @@ trait Accounts
}
/**
* @throws \MailSo\Base\Exceptions\Exception
* @throws \MailSo\RuntimeException
*/
public function DoAccountSetup(): array
{
@ -102,7 +102,7 @@ trait Accounts
}
/**
* @throws \MailSo\Base\Exceptions\Exception
* @throws \MailSo\RuntimeException
*/
public function DoAccountDelete(): array
{
@ -135,7 +135,7 @@ trait Accounts
}
/**
* @throws \MailSo\Base\Exceptions\Exception
* @throws \MailSo\RuntimeException
*/
public function DoAccountSwitch(): array
{
@ -170,7 +170,7 @@ trait Accounts
}
/**
* @throws \MailSo\Base\Exceptions\Exception
* @throws \MailSo\RuntimeException
*/
public function DoIdentityUpdate(): array
{
@ -186,7 +186,7 @@ trait Accounts
}
/**
* @throws \MailSo\Base\Exceptions\Exception
* @throws \MailSo\RuntimeException
*/
public function DoIdentityDelete(): array
{
@ -206,7 +206,7 @@ trait Accounts
}
/**
* @throws \MailSo\Base\Exceptions\Exception
* @throws \MailSo\RuntimeException
*/
public function DoAccountsAndIdentitiesSortOrder(): array
{
@ -237,7 +237,7 @@ trait Accounts
}
/**
* @throws \MailSo\Base\Exceptions\Exception
* @throws \MailSo\RuntimeException
*/
public function DoAccountsAndIdentities(): array
{

View file

@ -12,7 +12,7 @@ trait Filters
private $oFiltersProvider;
/**
* @throws \MailSo\Base\Exceptions\Exception
* @throws \MailSo\RuntimeException
*/
public function DoFilters() : array
{
@ -27,7 +27,7 @@ trait Filters
}
/**
* @throws \MailSo\Base\Exceptions\Exception
* @throws \MailSo\RuntimeException
*/
public function DoFiltersScriptSave() : array
{
@ -49,7 +49,7 @@ trait Filters
}
/**
* @throws \MailSo\Base\Exceptions\Exception
* @throws \MailSo\RuntimeException
*/
public function DoFiltersScriptActivate() : array
{
@ -65,7 +65,7 @@ trait Filters
}
/**
* @throws \MailSo\Base\Exceptions\Exception
* @throws \MailSo\RuntimeException
*/
public function DoFiltersScriptDelete() : array
{

View file

@ -21,7 +21,7 @@ trait Folders
/**
* Appends uploaded rfc822 message to mailbox
* @throws \MailSo\Base\Exceptions\Exception
* @throws \MailSo\RuntimeException
*/
public function Append(): bool
{
@ -318,7 +318,7 @@ trait Folders
}
/**
* @throws \MailSo\Base\Exceptions\Exception
* @throws \MailSo\RuntimeException
*/
public function DoFolderMove() : array
{
@ -341,7 +341,7 @@ trait Folders
}
/**
* @throws \MailSo\Base\Exceptions\Exception
* @throws \MailSo\RuntimeException
*/
public function DoFolderRename() : array
{
@ -369,7 +369,7 @@ trait Folders
}
/**
* @throws \MailSo\Base\Exceptions\Exception
* @throws \MailSo\RuntimeException
*/
public function DoFolderDelete() : array
{
@ -392,7 +392,7 @@ trait Folders
}
/**
* @throws \MailSo\Base\Exceptions\Exception
* @throws \MailSo\RuntimeException
*/
public function DoFolderClear() : array
{
@ -411,7 +411,7 @@ trait Folders
}
/**
* @throws \MailSo\Base\Exceptions\Exception
* @throws \MailSo\RuntimeException
*/
public function DoFolderInformation() : array
{
@ -433,7 +433,7 @@ trait Folders
}
/**
* @throws \MailSo\Base\Exceptions\Exception
* @throws \MailSo\RuntimeException
*/
public function DoFolderInformationMultiply() : array
{

View file

@ -14,7 +14,7 @@ use MailSo\Mime\Part as MimePart;
trait Messages
{
/**
* @throws \MailSo\Base\Exceptions\Exception
* @throws \MailSo\RuntimeException
*/
public function DoMessageList() : array
{
@ -422,7 +422,7 @@ trait Messages
}
/**
* @throws \MailSo\Base\Exceptions\Exception
* @throws \MailSo\RuntimeException
*/
public function DoMessage() : array
{
@ -470,7 +470,7 @@ trait Messages
}
/**
* @throws \MailSo\Base\Exceptions\Exception
* @throws \MailSo\RuntimeException
*/
public function DoMessageDelete() : array
{
@ -503,7 +503,7 @@ trait Messages
}
/**
* @throws \MailSo\Base\Exceptions\Exception
* @throws \MailSo\RuntimeException
*/
public function DoMessageMove() : array
{
@ -571,7 +571,7 @@ trait Messages
}
/**
* @throws \MailSo\Base\Exceptions\Exception
* @throws \MailSo\RuntimeException
*/
public function DoMessageCopy() : array
{

View file

@ -9,7 +9,7 @@ trait Pgp
*/
/**
* @throws \MailSo\Base\Exceptions\Exception
* @throws \MailSo\RuntimeException
*/
public function GnuPG() : ?\SnappyMail\PGP\GnuPG
{

View file

@ -5,7 +5,7 @@ namespace RainLoop\Actions;
trait Raw
{
/**
* @throws \MailSo\Base\Exceptions\Exception
* @throws \MailSo\RuntimeException
*/
public function RawViewAsPlain() : bool
{

View file

@ -33,7 +33,7 @@ trait User
}
/**
* @throws \MailSo\Base\Exceptions\Exception
* @throws \MailSo\RuntimeException
*/
public function DoLogin() : array
{
@ -69,7 +69,7 @@ trait User
}
/**
* @throws \MailSo\Base\Exceptions\Exception
* @throws \MailSo\RuntimeException
*/
public function DoAttachmentsActions() : array
{

View file

@ -100,7 +100,7 @@ class ActionsAdmin extends Actions
}
/**
* @throws \MailSo\Base\Exceptions\Exception
* @throws \MailSo\RuntimeException
*/
public function DoAdminLogin() : array
{