function TextPart::bodyToIterable
Overrides AbstractPart::bodyToIterable
1 method overrides TextPart::bodyToIterable()
- MessagePart::bodyToIterable in vendor/
symfony/ mime/ Part/ MessagePart.php
File
-
vendor/
symfony/ mime/ Part/ TextPart.php, line 151
Class
- TextPart
- @author Fabien Potencier <fabien@symfony.com>
Namespace
Symfony\Component\Mime\PartCode
public function bodyToIterable() : iterable {
if ($this->body instanceof File) {
$path = $this->body
->getPath();
if (false === ($handle = @fopen($path, 'r', false))) {
throw new InvalidArgumentException(\sprintf('Unable to open path "%s".', $path));
}
yield from $this->getEncoder()
->encodeByteStream($handle);
}
elseif (null !== $this->seekable) {
if ($this->seekable) {
rewind($this->body);
}
yield from $this->getEncoder()
->encodeByteStream($this->body);
}
else {
(yield $this->getEncoder()
->encodeString($this->body));
}
}