File tree 3 files changed +125
-10
lines changed
3 files changed +125
-10
lines changed Original file line number Diff line number Diff line change @@ -127,9 +127,9 @@ class Message extends Base
127
127
/**
128
128
* An array of recipients
129
129
*
130
- * @var array
130
+ * @var Recipients
131
131
*/
132
- public $ recipients = array () ;
132
+ public $ recipients ;
133
133
134
134
/**
135
135
* The URL to send status delivery reports for the message to
@@ -225,14 +225,8 @@ public function loadFromArray ($object)
225
225
{
226
226
parent ::loadFromArray ($ object );
227
227
228
- if (!empty ($ this ->recipients ->items )) {
229
- foreach ($ this ->recipients ->items AS &$ item ) {
230
- $ Recipient = new Recipient ();
231
- $ Recipient ->loadFromArray ($ item );
232
-
233
- $ item = $ Recipient ;
234
- }
235
- }
228
+ $ recipients = new Recipients ();
229
+ $ this ->recipients = $ recipients ->loadFromArray ($ this ->recipients );
236
230
237
231
return $ this ;
238
232
}
Original file line number Diff line number Diff line change @@ -35,4 +35,28 @@ class Recipient extends Base
35
35
* @var string
36
36
*/
37
37
public $ statusDatetime ;
38
+
39
+ /**
40
+ * @return int
41
+ */
42
+ public function getRecipient ()
43
+ {
44
+ return $ this ->recipient ;
45
+ }
46
+
47
+ /**
48
+ * @return string
49
+ */
50
+ public function getStatus ()
51
+ {
52
+ return $ this ->status ;
53
+ }
54
+
55
+ /**
56
+ * @return string
57
+ */
58
+ public function getStatusDatetime ()
59
+ {
60
+ return $ this ->statusDatetime ;
61
+ }
38
62
}
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace MessageBird \Objects ;
4
+
5
+ /**
6
+ * Class Recipients
7
+ *
8
+ * @package MessageBird\Objects
9
+ */
10
+ class Recipients extends Base
11
+ {
12
+ /**
13
+ * @var int
14
+ */
15
+ public $ totalCount ;
16
+
17
+ /**
18
+ * @var int
19
+ */
20
+ public $ totalSentCount ;
21
+
22
+ /**
23
+ * @var int
24
+ */
25
+ public $ totalDeliveredCount ;
26
+
27
+ /**
28
+ * @var int
29
+ */
30
+ public $ totalDeliveryFailedCount ;
31
+
32
+ /**
33
+ * @var Recipient[]
34
+ */
35
+ public $ items ;
36
+
37
+ /**
38
+ * @return int
39
+ */
40
+ public function getTotalCount ()
41
+ {
42
+ return $ this ->totalCount ;
43
+ }
44
+
45
+ /**
46
+ * @return int
47
+ */
48
+ public function getTotalSentCount ()
49
+ {
50
+ return $ this ->totalSentCount ;
51
+ }
52
+
53
+ /**
54
+ * @return int
55
+ */
56
+ public function getTotalDeliveredCount ()
57
+ {
58
+ return $ this ->totalDeliveredCount ;
59
+ }
60
+
61
+ /**
62
+ * @return int
63
+ */
64
+ public function getTotalDeliveryFailedCount ()
65
+ {
66
+ return $ this ->totalDeliveryFailedCount ;
67
+ }
68
+
69
+ /**
70
+ * @return Recipient[]
71
+ */
72
+ public function getItems ()
73
+ {
74
+ return $ this ->items ;
75
+ }
76
+
77
+ /**
78
+ * @param $object
79
+ *
80
+ * @return $this|void
81
+ */
82
+ public function loadFromArray ($ object )
83
+ {
84
+ parent ::loadFromArray ($ object );
85
+
86
+ if (!empty ($ this ->items )) {
87
+ foreach ($ this ->items as &$ item ) {
88
+ $ recipient = new Recipient ();
89
+ $ recipient ->loadFromArray ($ item );
90
+
91
+ $ item = $ recipient ;
92
+ }
93
+ }
94
+
95
+ return $ this ;
96
+ }
97
+ }
You can’t perform that action at this time.
0 commit comments