1 | <?php |
||
8 | class NotificationBuilder |
||
9 | { |
||
10 | /** |
||
11 | * @var Destination |
||
12 | */ |
||
13 | private $destination; |
||
14 | |||
15 | /** |
||
16 | * @var Subject |
||
17 | */ |
||
18 | private $subject; |
||
19 | |||
20 | /** |
||
21 | * @var Body |
||
22 | */ |
||
23 | private $body; |
||
24 | |||
25 | /** |
||
26 | * @var null|DeduplicationKey |
||
27 | */ |
||
28 | private $deduplicationKey; |
||
29 | |||
30 | /** |
||
31 | * @var null|array |
||
32 | */ |
||
33 | private $metadata; |
||
34 | |||
35 | /** |
||
36 | * @return void |
||
|
|||
37 | */ |
||
38 | 8 | private function __construct() |
|
47 | |||
48 | /** |
||
49 | * @return NotificationBuilder |
||
50 | */ |
||
51 | 8 | public static function notification(): NotificationBuilder |
|
55 | |||
56 | /** |
||
57 | * @param Destination $destination |
||
58 | * @return NotificationBuilder |
||
59 | */ |
||
60 | 1 | public function withDestination(Destination $destination): NotificationBuilder |
|
66 | |||
67 | /** |
||
68 | * @param Subject|string $subject |
||
69 | * @return NotificationBuilder |
||
70 | */ |
||
71 | public function withSubject($subject): NotificationBuilder |
||
80 | |||
81 | /** |
||
82 | * @param Body|string $body |
||
83 | * @return NotificationBuilder |
||
84 | */ |
||
85 | public function withBody($body): NotificationBuilder |
||
94 | |||
95 | /** |
||
96 | * @param DeduplicationKey|string $deduplicationKey |
||
97 | * @return NotificationBuilder |
||
98 | */ |
||
99 | public function withDeduplicationKey($deduplicationKey): NotificationBuilder |
||
108 | |||
109 | /** |
||
110 | * @param array $metadata |
||
111 | * @return NotificationBuilder |
||
112 | */ |
||
113 | 2 | public function withMetadata(array $metadata): NotificationBuilder |
|
119 | |||
120 | /** |
||
121 | * @return Notification |
||
122 | */ |
||
123 | 8 | public function build(): Notification |
|
133 | } |
||
134 |
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.