1 | <?php |
||
9 | class NotificationBuilder |
||
10 | { |
||
11 | /** |
||
12 | * @var Destination |
||
13 | */ |
||
14 | private $destination; |
||
15 | |||
16 | /** |
||
17 | * @var Subject |
||
18 | */ |
||
19 | private $subject; |
||
20 | |||
21 | /** |
||
22 | * @var Body |
||
23 | */ |
||
24 | private $body; |
||
25 | |||
26 | /** |
||
27 | * @var null|DeduplicationKey |
||
28 | */ |
||
29 | private $deduplicationKey; |
||
30 | |||
31 | /** |
||
32 | * @var null|array |
||
33 | */ |
||
34 | private $metadata; |
||
35 | |||
36 | /** |
||
37 | * @return void |
||
|
|||
38 | */ |
||
39 | 21 | private function __construct() |
|
48 | |||
49 | /** |
||
50 | * @return NotificationBuilder |
||
51 | */ |
||
52 | 21 | public static function notification(): NotificationBuilder |
|
56 | |||
57 | /** |
||
58 | * @param Destination $destination |
||
59 | * @return NotificationBuilder |
||
60 | */ |
||
61 | 1 | public function withDestination(Destination $destination): NotificationBuilder |
|
67 | |||
68 | /** |
||
69 | * @param Subject|string $subject |
||
70 | * @return NotificationBuilder |
||
71 | */ |
||
72 | public function withSubject($subject): NotificationBuilder |
||
81 | |||
82 | /** |
||
83 | * @param Body|string $body |
||
84 | * @return NotificationBuilder |
||
85 | */ |
||
86 | public function withBody($body): NotificationBuilder |
||
95 | |||
96 | /** |
||
97 | * @param DeduplicationKey|string $deduplicationKey |
||
98 | * @return NotificationBuilder |
||
99 | */ |
||
100 | 1 | public function withDeduplicationKey($deduplicationKey): NotificationBuilder |
|
109 | |||
110 | /** |
||
111 | * @param array $metadata |
||
112 | * @return NotificationBuilder |
||
113 | */ |
||
114 | 10 | public function withMetadata(array $metadata): NotificationBuilder |
|
120 | |||
121 | /** |
||
122 | * @return Notification |
||
123 | */ |
||
124 | 21 | public function build(): Notification |
|
134 | } |
||
135 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.