1 | <?php |
||
17 | abstract class AbstractNotification |
||
18 | { |
||
19 | use OptionsTrait; |
||
20 | |||
21 | const STATUS_PENDING = 0; |
||
22 | const STATUS_SENT = 1; |
||
23 | |||
24 | /** |
||
25 | * @var \Jgut\Tify\Service\AbstractService |
||
26 | */ |
||
27 | protected $service; |
||
28 | |||
29 | /** |
||
30 | * @var \Jgut\Tify\Message\AbstractMessage |
||
31 | */ |
||
32 | protected $message; |
||
33 | |||
34 | /** |
||
35 | * @var \Jgut\Tify\Recipient\AbstractRecipient[] |
||
36 | */ |
||
37 | protected $recipients = []; |
||
38 | |||
39 | /** |
||
40 | * @var int |
||
41 | */ |
||
42 | protected $status = self::STATUS_PENDING; |
||
43 | |||
44 | /** |
||
45 | * Notification resultss. |
||
46 | * |
||
47 | * @var array |
||
48 | */ |
||
49 | protected $results = []; |
||
50 | |||
51 | /** |
||
52 | * @param \Jgut\Tify\Service\AbstractService $service |
||
53 | * @param \Jgut\Tify\Message\AbstractMessage $message |
||
54 | * @param \Jgut\Tify\Recipient\AbstractRecipient[] $recipients |
||
55 | * @param array $options |
||
56 | */ |
||
57 | public function __construct( |
||
72 | |||
73 | /** |
||
74 | * Get default notification options. |
||
75 | * |
||
76 | * @return array |
||
77 | */ |
||
78 | protected function getDefaultOptions() |
||
82 | |||
83 | /** |
||
84 | * Get service. |
||
85 | * |
||
86 | * @return \Jgut\Tify\Service\AbstractService |
||
87 | */ |
||
88 | final public function getService() |
||
92 | |||
93 | /** |
||
94 | * Set service. |
||
95 | * |
||
96 | * @param \Jgut\Tify\Service\AbstractService $service |
||
97 | */ |
||
98 | abstract public function setService(AbstractService $service); |
||
99 | |||
100 | /** |
||
101 | * Get message. |
||
102 | * |
||
103 | * @return \Jgut\Tify\Message\AbstractMessage |
||
104 | */ |
||
105 | final public function getMessage() |
||
109 | |||
110 | /** |
||
111 | * Set message. |
||
112 | * |
||
113 | * @param \Jgut\Tify\Message\AbstractMessage $message |
||
114 | */ |
||
115 | abstract public function setMessage(AbstractMessage $message); |
||
116 | |||
117 | /** |
||
118 | * Retrieve list of recipients. |
||
119 | * |
||
120 | * @return \Jgut\Tify\Recipient\AbstractRecipient[] |
||
121 | */ |
||
122 | final public function getRecipients() |
||
126 | |||
127 | /** |
||
128 | * Add recipient. |
||
129 | * |
||
130 | * @param \Jgut\Tify\Recipient\AbstractRecipient $recipient |
||
131 | */ |
||
132 | abstract public function addRecipient(AbstractRecipient $recipient); |
||
133 | |||
134 | /** |
||
135 | * Retrieve notification status. |
||
136 | * |
||
137 | * @return int |
||
138 | */ |
||
139 | final public function getStatus() |
||
143 | |||
144 | /** |
||
145 | * Check if notification status is pushed. |
||
146 | * |
||
147 | * @return bool |
||
148 | */ |
||
149 | final public function isSent() |
||
153 | |||
154 | /** |
||
155 | * Set notification as sent. |
||
156 | * |
||
157 | * @param array $results |
||
158 | */ |
||
159 | final public function setSent(array $results = []) |
||
164 | |||
165 | /** |
||
166 | * Set notification pending (not sent). |
||
167 | */ |
||
168 | final public function setPending() |
||
173 | |||
174 | /** |
||
175 | * Retrieve results. |
||
176 | * |
||
177 | * @return \Jgut\Tify\Result[] |
||
178 | */ |
||
179 | final public function getResults() |
||
183 | |||
184 | /** |
||
185 | * Retrieve recipients tokens list. |
||
186 | * |
||
187 | * @return array |
||
|
|||
188 | */ |
||
189 | final public function getTokens() |
||
196 | } |
||
197 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.