@@ -27,9 +27,9 @@ public function __construct(MailjetService $mailjet)
2727
2828 /**
2929 * List campaign draft resources available for this apikey.
30- *
30+ * @param array|null $filters
3131 * @return array
32- * @throws \Mailjet\LaravelMailjet\Exception\ MailjetException
32+ * @throws MailjetException
3333 */
3434 public function getAllCampaignDrafts (array $ filters = null ): array
3535 {
@@ -44,12 +44,11 @@ public function getAllCampaignDrafts(array $filters = null): array
4444
4545 /**
4646 * Access a given CampaignDraft resource.
47- *
4847 * @param string $id
49- *
5048 * @return array
49+ * @throws MailjetException
5150 */
52- public function findByCampaignDraftId (string $ id )
51+ public function findByCampaignDraftId (string $ id ): array
5352 {
5453 $ response = $ this ->mailjet ->get (Resources::$ Campaigndraft ,
5554 ['id ' => $ id ]);
@@ -63,10 +62,10 @@ public function findByCampaignDraftId(string $id)
6362
6463 /**
6564 * create a new fresh CampaignDraft
66- *
6765 * @param Campaigndraft $campaignDraft
66+ * @throws MailjetException
6867 */
69- public function create (CampaignDraft $ campaignDraft )
68+ public function create (CampaignDraft $ campaignDraft ): array
7069 {
7170 $ response = $ this ->mailjet ->post (Resources::$ Campaigndraft ,
7271 ['body ' => $ campaignDraft ->format ()]);
@@ -79,11 +78,12 @@ public function create(CampaignDraft $campaignDraft)
7978
8079 /**
8180 * Update one specific campaigndraft resource
82- *
83- * @param int $id
81+ * @param string $id
8482 * @param Campaigndraft $campaignDraft
83+ * @return array
84+ * @throws MailjetException
8585 */
86- public function update ($ id , CampaignDraft $ campaignDraft )
86+ public function update (string $ id , CampaignDraft $ campaignDraft ): array
8787 {
8888 $ response = $ this ->mailjet ->put (Resources::$ Campaigndraft ,
8989 ['id ' => $ id , 'body ' => $ campaignDraft ->format ()]);
@@ -96,12 +96,11 @@ public function update($id, CampaignDraft $campaignDraft)
9696
9797 /**
9898 * Return the text and html contents of the campaigndraft
99- *
10099 * @param string $id
101- *
102100 * @return array
101+ * @throws MailjetException
103102 */
104- public function getDetailContent (string $ id )
103+ public function getDetailContent (string $ id ): array
105104 {
106105 $ response = $ this ->mailjet ->get (Resources::$ CampaigndraftDetailcontent ,
107106 ['id ' => $ id ]);
@@ -115,12 +114,12 @@ public function getDetailContent(string $id)
115114
116115 /**
117116 * Creates the content of a campaigndraft
118- *
119117 * @param string $id
120- *
118+ * @param array $contentData
121119 * @return array
120+ * @throws MailjetException
122121 */
123- public function createDetailContent ($ id , $ contentData )
122+ public function createDetailContent (string $ id , array $ contentData ): array
124123 {
125124 $ response = $ this ->mailjet ->post (Resources::$ CampaigndraftDetailcontent ,
126125 ['id ' => $ id , 'body ' => $ contentData ]);
@@ -134,12 +133,11 @@ public function createDetailContent($id, $contentData)
134133
135134 /**
136135 * Return the date of the scheduled sending of the campaigndraft
137- *
138- * @param string Campaign $id
139- *
136+ * @param string $id
140137 * @return array
138+ * @throws MailjetException
141139 */
142- public function getSchedule (string $ id )
140+ public function getSchedule (string $ id ): array
143141 {
144142 $ response = $ this ->mailjet ->get (Resources::$ CampaigndraftSchedule ,
145143 ['id ' => $ id ]);
@@ -153,13 +151,12 @@ public function getSchedule(string $id)
153151
154152 /**
155153 * Schedule when the campaigndraft will be sent
156- *
157154 * @param string $id
158155 * @param string $date (RFC3339 format "Y-m-d\TH:i:sP")
159- *
160156 * @return array
157+ * @throws MailjetException
161158 */
162- public function scheduleCampaign (string $ id , string $ date )
159+ public function scheduleCampaign (string $ id , string $ date ): array
163160 {
164161 $ response = $ this ->mailjet ->post (Resources::$ CampaigndraftSchedule ,
165162 ['id ' => $ id , 'body ' => $ date ]);
@@ -173,13 +170,12 @@ public function scheduleCampaign(string $id, string $date)
173170
174171 /**
175172 * Update the date when the campaigndraft will be sent
176- *
177- * @param string Campaign $id
178- * @param string Schedule $date
179- *
173+ * @param string $id
174+ * @param string $date
180175 * @return array
176+ * @throws MailjetException
181177 */
182- public function updateCampaignSchedule ($ id , $ date )
178+ public function updateCampaignSchedule (string $ id , string $ date ): array
183179 {
184180 $ response = $ this ->mailjet ->put (Resources::$ CampaigndraftSchedule ,
185181 ['id ' => $ id , 'body ' => $ date ]);
@@ -193,12 +189,11 @@ public function updateCampaignSchedule($id, $date)
193189
194190 /**
195191 * Cancel a future sending
196- *
197- * @param string Campaign $id
198- *
192+ * @param string $id
199193 * @return array
194+ * @throws MailjetException
200195 */
201- public function removeSchedule (string $ id )
196+ public function removeSchedule (string $ id ): array
202197 {
203198 $ response = $ this ->mailjet ->delete (Resources::$ CampaigndraftSchedule ,
204199 ['id ' => $ id ]);
@@ -212,12 +207,11 @@ public function removeSchedule(string $id)
212207
213208 /**
214209 * Send the campaign immediately
215- *
216- * @param string Campaign $id
217- *
210+ * @param string $id
218211 * @return array
212+ * @throws MailjetException
219213 */
220- public function sendCampaign (string $ id )
214+ public function sendCampaign (string $ id ): array
221215 {
222216 $ response = $ this ->mailjet ->post (Resources::$ CampaigndraftSend ,
223217 ['id ' => $ id ]);
@@ -231,12 +225,11 @@ public function sendCampaign(string $id)
231225
232226 /**
233227 * Return the status of a CampaignDraft
234- *
235- * @param string Campaign $id
236- *
228+ * @param string $id
237229 * @return array
230+ * @throws MailjetException
238231 */
239- public function getCampaignStatus (string $ id )
232+ public function getCampaignStatus (string $ id ): array
240233 {
241234 $ response = $ this ->mailjet ->get (Resources::$ CampaigndraftStatus ,
242235 ['id ' => $ id ]);
@@ -250,13 +243,12 @@ public function getCampaignStatus(string $id)
250243
251244 /**
252245 * An action to test a CampaignDraft.
253- *
254- * @param string Campaign $id
255- * @param array of $recipients
256- *
246+ * @param string $id
247+ * @param array $recipients
257248 * @return array
249+ * @throws MailjetException
258250 */
259- public function testCampaign ($ id , $ recipients )
251+ public function testCampaign (string $ id , array $ recipients ): array
260252 {
261253 $ response = $ this ->mailjet ->post (Resources::$ CampaigndraftTest ,
262254 ['id ' => $ id , 'body ' => $ recipients ]);
@@ -268,7 +260,12 @@ public function testCampaign($id, $recipients)
268260 return $ response ->getData ();
269261 }
270262
271- private function throwError ($ title , Response $ response )
263+ /**
264+ * @param $title
265+ * @param Response $response
266+ * @throws MailjetException
267+ */
268+ private function throwError ($ title , Response $ response ): void
272269 {
273270 throw new MailjetException (0 , $ title , $ response );
274271 }
0 commit comments