Skip to content

Commit f253727

Browse files
committed
[Mime] Simplify code
1 parent 9c02479 commit f253727

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Email.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -501,16 +501,11 @@ private function prepareParts(): ?array
501501
$names = array_filter(array_unique($names));
502502
}
503503

504-
// usage of reflection is a temporary workaround for missing getters that will be added in 6.2
505-
$dispositionRef = new \ReflectionProperty(TextPart::class, 'disposition');
506-
$dispositionRef->setAccessible(true);
507-
$nameRef = new \ReflectionProperty(TextPart::class, 'name');
508-
$nameRef->setAccessible(true);
509504
$attachmentParts = $inlineParts = [];
510505
foreach ($this->attachments as $attachment) {
511506
$part = $this->createDataPart($attachment);
512507
if (isset($attachment['part'])) {
513-
$attachment['name'] = $nameRef->getValue($part);
508+
$attachment['name'] = $part->getName();
514509
}
515510

516511
foreach ($names as $name) {
@@ -527,7 +522,7 @@ private function prepareParts(): ?array
527522
break;
528523
}
529524

530-
if ('inline' === $dispositionRef->getValue($part)) {
525+
if ('inline' === $part->getDisposition()) {
531526
$inlineParts[$attachment['name']] = $part;
532527
} else {
533528
$attachmentParts[] = $part;

Part/TextPart.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ public function setDisposition(string $disposition): static
8989
return $this;
9090
}
9191

92+
public function getDisposition(): ?string
93+
{
94+
return $this->disposition;
95+
}
96+
9297
/**
9398
* Sets the name of the file (used by FormDataPart).
9499
*
@@ -102,7 +107,7 @@ public function setName(string $name): static
102107
}
103108

104109
/**
105-
* Gets the name of the file (used by FormDataPart).
110+
* Gets the name of the file.
106111
*/
107112
public function getName(): ?string
108113
{

0 commit comments

Comments
 (0)