package and depencies

This commit is contained in:
RafficMohammed
2023-01-08 02:57:24 +05:30
parent d5332eb421
commit 1d54b8bc7f
4309 changed files with 193331 additions and 172289 deletions

View File

@@ -58,7 +58,7 @@ final class MessageConverter
throw new RuntimeException(sprintf('Unable to create an Email from an instance of "%s" as the body is too complex.', get_debug_type($message)));
}
return self::attachParts($email, \array_slice($parts, 1));
return self::addParts($email, \array_slice($parts, 1));
}
throw new RuntimeException(sprintf('Unable to create an Email from an instance of "%s" as the body is too complex.', get_debug_type($message)));
@@ -104,20 +104,17 @@ final class MessageConverter
throw new RuntimeException(sprintf('Unable to create an Email from an instance of "%s" as the body is too complex.', get_debug_type($message)));
}
return self::attachParts($email, \array_slice($parts, 1));
return self::addParts($email, \array_slice($parts, 1));
}
private static function attachParts(Email $email, array $parts): Email
private static function addParts(Email $email, array $parts): Email
{
foreach ($parts as $part) {
if (!$part instanceof DataPart) {
throw new RuntimeException(sprintf('Unable to create an Email from an instance of "%s" as the body is too complex.', get_debug_type($email)));
}
$headers = $part->getPreparedHeaders();
$method = 'inline' === $headers->getHeaderBody('Content-Disposition') ? 'embed' : 'attach';
$name = $headers->getHeaderParameter('Content-Disposition', 'filename');
$email->$method($part->getBody(), $name, $part->getMediaType().'/'.$part->getMediaSubtype());
$email->addPart($part);
}
return $email;