Remove useless NewInstance

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

View file

@ -50,7 +50,7 @@ class Folder
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
*/
private function __construct(string $sFullNameRaw, string $sDelimiter, array $aFlags)
function __construct(string $sFullNameRaw, string $sDelimiter = '.', array $aFlags = array())
{
$sDelimiter = 'NIL' === \strtoupper($sDelimiter) ? '' : $sDelimiter;
if (empty($sDelimiter))
@ -60,7 +60,7 @@ class Folder
if (1 < \strlen($sDelimiter) || 0 === \strlen($sFullNameRaw))
{
throw new \MailSo\Base\Exceptions\InvalidArgumentException();
throw new \MailSo\Base\Exceptions\InvalidArgumentException;
}
$this->sFullNameRaw = $sFullNameRaw;
@ -82,21 +82,13 @@ class Folder
$aNames = \explode($this->sDelimiter, $this->sFullNameRaw);
if (false !== \array_search('', $aNames))
{
throw new \MailSo\Base\Exceptions\InvalidArgumentException();
throw new \MailSo\Base\Exceptions\InvalidArgumentException;
}
$this->sNameRaw = \end($aNames);
}
}
/**
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
*/
public static function NewInstance(string $sFullNameRaw, string $sDelimiter = '.', array $aFlags = array()) : self
{
return new self($sFullNameRaw, $sDelimiter, $aFlags);
}
public function NameRaw() : string
{
return $this->sNameRaw;