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\Mailables;
4
 
5
use Illuminate\Support\Str;
6
use Illuminate\Support\Traits\Conditionable;
7
 
8
class Headers
9
{
10
    use Conditionable;
11
 
12
    /**
13
     * The message's message ID.
14
     *
15
     * @var string|null
16
     */
17
    public $messageId;
18
 
19
    /**
20
     * The message IDs that are referenced by the message.
21
     *
22
     * @var array
23
     */
24
    public $references;
25
 
26
    /**
27
     * The message's text headers.
28
     *
29
     * @var array
30
     */
31
    public $text;
32
 
33
    /**
34
     * Create a new instance of headers for a message.
35
     *
36
     * @param  string|null  $messageId
37
     * @param  array  $references
38
     * @param  array  $text
39
     * @return void
40
     *
41
     * @named-arguments-supported
42
     */
43
    public function __construct(string $messageId = null, array $references = [], array $text = [])
44
    {
45
        $this->messageId = $messageId;
46
        $this->references = $references;
47
        $this->text = $text;
48
    }
49
 
50
    /**
51
     * Set the message ID.
52
     *
53
     * @param  string  $messageId
54
     * @return $this
55
     */
56
    public function messageId(string $messageId)
57
    {
58
        $this->messageId = $messageId;
59
 
60
        return $this;
61
    }
62
 
63
    /**
64
     * Set the message IDs referenced by this message.
65
     *
66
     * @param  array  $references
67
     * @return $this
68
     */
69
    public function references(array $references)
70
    {
71
        $this->references = array_merge($this->references, $references);
72
 
73
        return $this;
74
    }
75
 
76
    /**
77
     * Set the headers for this message.
78
     *
79
     * @param  array  $references
80
     * @return $this
81
     */
82
    public function text(array $text)
83
    {
84
        $this->text = array_merge($this->text, $text);
85
 
86
        return $this;
87
    }
88
 
89
    /**
90
     * Get the references header as a string.
91
     *
92
     * @return string
93
     */
94
    public function referencesString(): string
95
    {
96
        return collect($this->references)->map(function ($messageId) {
97
            return Str::finish(Str::start($messageId, '<'), '>');
98
        })->implode(' ');
99
    }
100
}