snappymail/rainloop/v/0.0.0/app/libraries/MailSo/Mime/AttachmentCollection.php
djmaze 693e0f4c10 Remove useless NewInstance
Bugfix: BodyStructure->SearchCharset return value
2020-05-08 11:49:18 +02:00

56 lines
1 KiB
PHP

<?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\Mime;
/**
* @category MailSo
* @package Mime
*/
class AttachmentCollection extends \MailSo\Base\Collection
{
public function append($oAttachment, bool $bToTop = false) : void
{
assert($oAttachment instanceof Attachment);
parent::append($oAttachment, $bToTop);
}
public function LinkedAttachments() : array
{
$aResult = array();
foreach ($this as $oAttachment) {
if ($oAttachment->IsLinked()) {
$aResult[] = $oAttachment;
}
}
return $aResult;
}
public function UnlinkedAttachments() : array
{
$aResult = array();
foreach ($this as $oAttachment) {
if (!$oAttachment->IsLinked()) {
$aResult[] = $oAttachment;
}
}
return $aResult;
}
public function SizeOfAttachments() : int
{
$iResult = 0;
foreach ($this as $oAttachment) {
$iResult += $oAttachment->FileSize();
}
return $iResult;
}
}