Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace Illuminate\Mail\Transport;
4
 
5
use Illuminate\Support\Collection;
6
use Symfony\Component\Mailer\Envelope;
7
use Symfony\Component\Mailer\SentMessage;
8
use Symfony\Component\Mailer\Transport\TransportInterface;
9
use Symfony\Component\Mime\RawMessage;
10
 
11
class ArrayTransport implements TransportInterface
12
{
13
    /**
14
     * The collection of Symfony Messages.
15
     *
16
     * @var \Illuminate\Support\Collection
17
     */
18
    protected $messages;
19
 
20
    /**
21
     * Create a new array transport instance.
22
     *
23
     * @return void
24
     */
25
    public function __construct()
26
    {
27
        $this->messages = new Collection;
28
    }
29
 
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function send(RawMessage $message, Envelope $envelope = null): ?SentMessage
34
    {
35
        return $this->messages[] = new SentMessage($message, $envelope ?? Envelope::create($message));
36
    }
37
 
38
    /**
39
     * Retrieve the collection of messages.
40
     *
41
     * @return \Illuminate\Support\Collection
42
     */
43
    public function messages()
44
    {
45
        return $this->messages;
46
    }
47
 
48
    /**
49
     * Clear all of the messages from the local collection.
50
     *
51
     * @return \Illuminate\Support\Collection
52
     */
53
    public function flush()
54
    {
55
        return $this->messages = new Collection;
56
    }
57
 
58
    /**
59
     * Get the string representation of the transport.
60
     *
61
     * @return string
62
     */
63
    public function __toString(): string
64
    {
65
        return 'array';
66
    }
67
}