mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-05 23:47:03 +03:00
More functions without type hinting found and fixt
Use PECL yaml (else Spyc) Upgrade Spyc (with removed dump code)
This commit is contained in:
parent
cd3d8b94b2
commit
75b4b64118
43 changed files with 893 additions and 1482 deletions
|
|
@ -48,11 +48,9 @@ class FetchResponse
|
|||
}
|
||||
|
||||
/**
|
||||
* @param mixed $mNullResult = null
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function GetFetchEnvelopeValue(int $iIndex, $mNullResult)
|
||||
public function GetFetchEnvelopeValue(int $iIndex, ?string $mNullResult = null)
|
||||
{
|
||||
return self::findEnvelopeIndex($this->GetEnvelope(), $iIndex, $mNullResult);
|
||||
}
|
||||
|
|
@ -60,7 +58,7 @@ class FetchResponse
|
|||
public function GetFetchEnvelopeEmailCollection(int $iIndex, string $sParentCharset = \MailSo\Base\Enumerations\Charset::ISO_8859_1) : ?\MailSo\Mime\EmailCollection
|
||||
{
|
||||
$oResult = null;
|
||||
$aEmails = $this->GetFetchEnvelopeValue($iIndex, null);
|
||||
$aEmails = $this->GetFetchEnvelopeValue($iIndex);
|
||||
if (is_array($aEmails) && 0 < count($aEmails))
|
||||
{
|
||||
$oResult = \MailSo\Mime\EmailCollection::NewInstance();
|
||||
|
|
@ -92,22 +90,18 @@ class FetchResponse
|
|||
|
||||
public function GetFetchBodyStructure(string $sRfc822SubMimeIndex = '') : ?BodyStructure
|
||||
{
|
||||
$oBodyStructure = null;
|
||||
$aBodyStructureArray = $this->GetFetchValue(Enumerations\FetchType::BODYSTRUCTURE);
|
||||
|
||||
if (is_array($aBodyStructureArray))
|
||||
{
|
||||
if (0 < strlen($sRfc822SubMimeIndex))
|
||||
{
|
||||
$oBodyStructure = BodyStructure::NewInstanceFromRfc822SubPart($aBodyStructureArray, $sRfc822SubMimeIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
$oBodyStructure = BodyStructure::NewInstance($aBodyStructureArray);
|
||||
return BodyStructure::NewInstanceFromRfc822SubPart($aBodyStructureArray, $sRfc822SubMimeIndex);
|
||||
}
|
||||
return BodyStructure::NewInstance($aBodyStructureArray);
|
||||
}
|
||||
|
||||
return $oBodyStructure;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -144,7 +138,6 @@ class FetchResponse
|
|||
|
||||
public function GetHeaderFieldsValue(string $sRfc822SubMimeIndex = '') : string
|
||||
{
|
||||
$sReturn = '';
|
||||
$bNextIsValue = false;
|
||||
|
||||
$sRfc822SubMimeIndex = 0 < \strlen($sRfc822SubMimeIndex) ? ''.$sRfc822SubMimeIndex.'.' : '';
|
||||
|
|
@ -155,8 +148,7 @@ class FetchResponse
|
|||
{
|
||||
if ($bNextIsValue)
|
||||
{
|
||||
$sReturn = (string) $mItem;
|
||||
break;
|
||||
return (string) $mItem;
|
||||
}
|
||||
|
||||
if (\is_string($mItem) && (
|
||||
|
|
@ -169,28 +161,24 @@ class FetchResponse
|
|||
}
|
||||
}
|
||||
|
||||
return $sReturn;
|
||||
return '';
|
||||
}
|
||||
|
||||
private static function findFetchUidAndSize(array $aList) : bool
|
||||
{
|
||||
$bUid = false;
|
||||
$bSize = false;
|
||||
if (is_array($aList))
|
||||
foreach ($aList as $mItem)
|
||||
{
|
||||
foreach ($aList as $mItem)
|
||||
if (Enumerations\FetchType::UID === $mItem)
|
||||
{
|
||||
if (Enumerations\FetchType::UID === $mItem)
|
||||
{
|
||||
$bUid = true;
|
||||
}
|
||||
else if (Enumerations\FetchType::RFC822_SIZE === $mItem)
|
||||
{
|
||||
$bSize = true;
|
||||
}
|
||||
$bUid = true;
|
||||
}
|
||||
else if (Enumerations\FetchType::RFC822_SIZE === $mItem)
|
||||
{
|
||||
$bSize = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $bUid && $bSize;
|
||||
}
|
||||
|
||||
|
|
@ -216,11 +204,9 @@ class FetchResponse
|
|||
}
|
||||
|
||||
/**
|
||||
* @param mixed $mNullResult = null
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
private static function findEnvelopeIndex(array $aEnvelope, int $iIndex, $mNullResult)
|
||||
private static function findEnvelopeIndex(array $aEnvelope, int $iIndex, ?string $mNullResult)
|
||||
{
|
||||
return (isset($aEnvelope[$iIndex]) && 'NIL' !== $aEnvelope[$iIndex] && '' !== $aEnvelope[$iIndex])
|
||||
? $aEnvelope[$iIndex] : $mNullResult;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue