[Mime] removed the 2 parts constraints on Multipart (not true for DataFormPart for instance)
This commit is contained in:
parent
0450c4f244
commit
5c8a4e3deb
@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Mime\Part;
|
namespace Symfony\Component\Mime\Part;
|
||||||
|
|
||||||
use Symfony\Component\Mime\Exception\LogicException;
|
|
||||||
use Symfony\Component\Mime\Header\Headers;
|
use Symfony\Component\Mime\Header\Headers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -57,11 +56,6 @@ abstract class AbstractMultipartPart extends AbstractPart
|
|||||||
public function bodyToString(): string
|
public function bodyToString(): string
|
||||||
{
|
{
|
||||||
$parts = $this->getParts();
|
$parts = $this->getParts();
|
||||||
|
|
||||||
if (\count($parts) < 2) {
|
|
||||||
throw new LogicException(sprintf('A "%s" instance must have at least 2 parts.', __CLASS__));
|
|
||||||
}
|
|
||||||
|
|
||||||
$string = '';
|
$string = '';
|
||||||
foreach ($parts as $part) {
|
foreach ($parts as $part) {
|
||||||
$string .= '--'.$this->getBoundary()."\r\n".$part->toString()."\r\n";
|
$string .= '--'.$this->getBoundary()."\r\n".$part->toString()."\r\n";
|
||||||
@ -74,11 +68,6 @@ abstract class AbstractMultipartPart extends AbstractPart
|
|||||||
public function bodyToIterable(): iterable
|
public function bodyToIterable(): iterable
|
||||||
{
|
{
|
||||||
$parts = $this->getParts();
|
$parts = $this->getParts();
|
||||||
|
|
||||||
if (\count($parts) < 2) {
|
|
||||||
throw new LogicException(sprintf('A "%s" instance must have at least 2 parts.', __CLASS__));
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($parts as $part) {
|
foreach ($parts as $part) {
|
||||||
yield '--'.$this->getBoundary()."\r\n";
|
yield '--'.$this->getBoundary()."\r\n";
|
||||||
foreach ($part->toIterable() as $chunk) {
|
foreach ($part->toIterable() as $chunk) {
|
||||||
|
Reference in New Issue
Block a user