1 | <?php |
||
29 | final class Response implements InitializationInterface { |
||
30 | /** |
||
31 | * @var int content type identifier for payload data serialization |
||
32 | */ |
||
33 | public static $type = PayloadMessage::TYPE_PLAIN; |
||
34 | |||
35 | /** |
||
36 | * @var string multicast identifier |
||
37 | */ |
||
38 | private $multicastId = ''; |
||
39 | |||
40 | /** |
||
41 | * @var int success messages count |
||
42 | */ |
||
43 | private $successCount = 0; |
||
44 | |||
45 | /** |
||
46 | * @var int failure messages count |
||
47 | */ |
||
48 | private $failureCount = 0; |
||
49 | |||
50 | /** |
||
51 | * @var int count of found devices with canonical identifiers |
||
52 | */ |
||
53 | private $canonicalIdsCount = 0; |
||
54 | |||
55 | /** |
||
56 | * @var Status[] result statuses |
||
57 | */ |
||
58 | private $results = []; |
||
59 | |||
60 | /** |
||
61 | * Count of canonical identifiers setter |
||
62 | * @param int $canonicalIdsCount count of canonical identifiers |
||
63 | * @return Response self |
||
64 | */ |
||
65 | 1 | public function setCanonicalIdsCount($canonicalIdsCount) { |
|
69 | |||
70 | /** |
||
71 | * Getter for count of canonical identifiers |
||
72 | * @return int count of canonical identifiers |
||
73 | */ |
||
74 | 4 | public function getCanonicalIdsCount() { |
|
77 | |||
78 | /** |
||
79 | * Count of failure messages setter |
||
80 | * @param int $failureCount failure messages count |
||
81 | * @return Response self |
||
82 | */ |
||
83 | 1 | public function setFailureCount($failureCount) { |
|
87 | |||
88 | /** |
||
89 | * Count of failure messages getter |
||
90 | * @return int failure messages getter |
||
91 | */ |
||
92 | 4 | public function getFailureCount() { |
|
95 | |||
96 | /** |
||
97 | * Multicast identifier setter |
||
98 | * @param string $multicastId multicast identifier |
||
99 | * @return Response self |
||
100 | */ |
||
101 | 1 | public function setMulticastId($multicastId) { |
|
105 | |||
106 | /** |
||
107 | * Multicast identifier getter |
||
108 | * @return string multicast identifier |
||
109 | */ |
||
110 | 2 | public function getMulticastId() { |
|
113 | |||
114 | /** |
||
115 | * Count of success messages setter |
||
116 | * @param int $successCount success messages count |
||
117 | * @return Response self |
||
118 | */ |
||
119 | 1 | public function setSuccessCount($successCount) { |
|
123 | |||
124 | /** |
||
125 | * Count of success messages getter |
||
126 | * @return int count of success messages |
||
127 | */ |
||
128 | 4 | public function getSuccessCount() { |
|
131 | |||
132 | /** |
||
133 | * Result statuses getter |
||
134 | * @return Status[] result statuses |
||
135 | */ |
||
136 | 5 | public function getResults() { |
|
139 | |||
140 | /** |
||
141 | * Initialization method |
||
142 | * @param string $string data for object initialization |
||
143 | * @return $this initialized object |
||
144 | * @throws GCMFormatException for unknown response format |
||
145 | */ |
||
146 | 5 | public static function initializeByString($string) { |
|
156 | |||
157 | /** |
||
158 | * Create response object by plain text data |
||
159 | * @param string $string plain text data |
||
160 | * @return Response self |
||
161 | * @throws GCMFormatException when plain text data format was not supported |
||
162 | */ |
||
163 | 2 | private static function createPlainResponse($string) { |
|
195 | |||
196 | /** |
||
197 | * Create response object by JSON data |
||
198 | * @param string $string JSON response data |
||
199 | * @return Response self |
||
200 | */ |
||
201 | 2 | private static function createJsonResponse($string) { |
|
224 | } |
||
225 |