generated from Nodarx/template
feat: initial version
Signed-off-by: Sebastian Krupinski <root@LAPTOP-7DVOR6NC>
This commit was merged in pull request #1.
This commit is contained in:
31
lib/Client/Mime/Part/MultiPart.php
Normal file
31
lib/Client/Mime/Part/MultiPart.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Gricob\IMAP\Mime\Part;
|
||||
|
||||
final readonly class MultiPart extends Part
|
||||
{
|
||||
/**
|
||||
* @param array<string,string> $attributes
|
||||
* @param list<Part> $parts
|
||||
*/
|
||||
public function __construct(
|
||||
string $subtype,
|
||||
array $attributes,
|
||||
public array $parts,
|
||||
) {
|
||||
parent::__construct('multipart', $subtype, $attributes);
|
||||
}
|
||||
|
||||
public function findPartByMimeType(string $mimeType): ?SinglePart
|
||||
{
|
||||
foreach ($this->parts as $part) {
|
||||
if ($matchedPart = $part->findPartByMimeType(strtolower($mimeType))) {
|
||||
return $matchedPart;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user