1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Mailer\Event;
13
14use Symfony\Component\Mailer\Envelope;
15use Symfony\Component\Mime\RawMessage;
16use Symfony\Contracts\EventDispatcher\Event;
17
18/**
19 * Allows the transformation of a Message and the Envelope before the email is sent.
20 *
21 * @author Fabien Potencier <fabien@symfony.com>
22 */
23final class MessageEvent extends Event
24{
25    private $message;
26    private $envelope;
27    private $transport;
28    private $queued;
29
30    public function __construct(RawMessage $message, Envelope $envelope, string $transport, bool $queued = false)
31    {
32        $this->message = $message;
33        $this->envelope = $envelope;
34        $this->transport = $transport;
35        $this->queued = $queued;
36    }
37
38    public function getMessage(): RawMessage
39    {
40        return $this->message;
41    }
42
43    public function setMessage(RawMessage $message): void
44    {
45        $this->message = $message;
46    }
47
48    public function getEnvelope(): Envelope
49    {
50        return $this->envelope;
51    }
52
53    public function setEnvelope(Envelope $envelope): void
54    {
55        $this->envelope = $envelope;
56    }
57
58    public function getTransport(): string
59    {
60        return $this->transport;
61    }
62
63    public function isQueued(): bool
64    {
65        return $this->queued;
66    }
67}
68