mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
[snappymail] Remove some more overuse of trim()
The FolderCreate() function also misses using trim() sometimes on $sFolderParentFullNameRaw, so this should be more correct as well.
This commit is contained in:
parent
542a1c9624
commit
b658b79264
1 changed files with 5 additions and 4 deletions
|
|
@ -2084,26 +2084,27 @@ class MailClient
|
||||||
public function FolderCreate(string $sFolderNameInUtf8, string $sFolderParentFullNameRaw = '', bool $bSubscribeOnCreation = true, string $sDelimiter = '') : self
|
public function FolderCreate(string $sFolderNameInUtf8, string $sFolderParentFullNameRaw = '', bool $bSubscribeOnCreation = true, string $sDelimiter = '') : self
|
||||||
{
|
{
|
||||||
$sFolderNameInUtf8 = \trim($sFolderNameInUtf8);
|
$sFolderNameInUtf8 = \trim($sFolderNameInUtf8);
|
||||||
|
$sFolderParentFullNameRaw = \trim($sFolderParentFullNameRaw);
|
||||||
|
|
||||||
if (0 === \strlen($sFolderNameInUtf8))
|
if (0 === \strlen($sFolderNameInUtf8))
|
||||||
{
|
{
|
||||||
throw new \MailSo\Base\Exceptions\InvalidArgumentException;
|
throw new \MailSo\Base\Exceptions\InvalidArgumentException;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 === \strlen($sDelimiter) || 0 < \strlen(\trim($sFolderParentFullNameRaw)))
|
if (0 === \strlen($sDelimiter) || 0 < \strlen($sFolderParentFullNameRaw))
|
||||||
{
|
{
|
||||||
$aFolders = $this->oImapClient->FolderList('', 0 === \strlen(\trim($sFolderParentFullNameRaw)) ? 'INBOX' : $sFolderParentFullNameRaw);
|
$aFolders = $this->oImapClient->FolderList('', 0 === \strlen($sFolderParentFullNameRaw) ? 'INBOX' : $sFolderParentFullNameRaw);
|
||||||
if (!$aFolders)
|
if (!$aFolders)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
throw new \MailSo\Mail\Exceptions\RuntimeException(
|
throw new \MailSo\Mail\Exceptions\RuntimeException(
|
||||||
0 === \strlen(trim($sFolderParentFullNameRaw))
|
0 === \strlen($sFolderParentFullNameRaw)
|
||||||
? 'Cannot get folder delimiter'
|
? 'Cannot get folder delimiter'
|
||||||
: 'Cannot create folder in non-existen parent folder');
|
: 'Cannot create folder in non-existen parent folder');
|
||||||
}
|
}
|
||||||
|
|
||||||
$sDelimiter = $aFolders[0]->Delimiter();
|
$sDelimiter = $aFolders[0]->Delimiter();
|
||||||
if (0 < \strlen($sDelimiter) && 0 < \strlen(\trim($sFolderParentFullNameRaw)))
|
if (0 < \strlen($sDelimiter) && 0 < \strlen($sFolderParentFullNameRaw))
|
||||||
{
|
{
|
||||||
$sFolderParentFullNameRaw .= $sDelimiter;
|
$sFolderParentFullNameRaw .= $sDelimiter;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue