for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace AcMailer\Attachment\Parser;
use AcMailer\Attachment\Helper\AttachmentHelperTrait;
use AcMailer\Exception\InvalidAttachmentException;
use Zend\Mime;
class MimePartAttachmentParser implements AttachmentParserInterface
{
use AttachmentHelperTrait;
/**
* @param string|resource|array|Mime\Part $attachment
* @param string|null $attachmentName
* @return Mime\Part
* @throws InvalidAttachmentException
*/
public function parse($attachment, string $attachmentName = null): Mime\Part
if (! $attachment instanceof Mime\Part) {
throw InvalidAttachmentException::fromExpectedType(Mime\Part::class);
}
return $this->applyNameToPart($attachment, $attachmentName);