ensureBodyValid example

return $body;
        }

        return $this->generateBody();
    }

    /** * @return void */
    public function ensureValidity()
    {
        $this->ensureBodyValid();

        if ('1' === $this->getHeaders()->getHeaderBody('X-Unsent')) {
            throw new LogicException('Cannot send messages marked as "draft".');
        }

        parent::ensureValidity();
    }

    private function ensureBodyValid(): void
    {
        if (null === $this->text && null === $this->html && !$this->attachments) {
            
return $body;
        }

        return $this->generateBody();
    }

    /** * @return void */
    public function ensureValidity()
    {
        $this->ensureBodyValid();

        if ('1' === $this->getHeaders()->getHeaderBody('X-Unsent')) {
            throw new LogicException('Cannot send messages marked as "draft".');
        }

        parent::ensureValidity();
    }

    private function ensureBodyValid(): void
    {
        if (null === $this->text && null === $this->html && !$this->attachments) {
            
Home | Imprint | This part of the site doesn't use cookies.