1 | <?php |
||
25 | final class Status { |
||
26 | /** |
||
27 | * Error constants |
||
28 | */ |
||
29 | const STATUS_UNAVAILABLE = 'Unavailable', |
||
30 | STATUS_NOT_REGISTERED = 'NotRegistered', |
||
31 | STATUS_MISSING_REGISTRATION = 'MissingRegistration', |
||
32 | STATUS_INVALID_REGISTRATION = 'InvalidRegistration', |
||
33 | STATUS_MISMATCH_SENDER_ID = 'MismatchSenderId', |
||
34 | STATUS_MESSAGE_TOO_BIG = 'MessageTooBig', |
||
35 | STATUS_INVALID_DATA_KEY = 'InvalidDataKey', |
||
36 | STATUS_INVALID_TTL = 'InvalidTtl', |
||
37 | STATUS_INTERNAL_SERVER_ERROR = 'InternalServerError'; |
||
38 | |||
39 | /** |
||
40 | * @var string message identifier |
||
41 | */ |
||
42 | private $messageId = ''; |
||
43 | |||
44 | /** |
||
45 | * @var string canonical device identifier |
||
46 | */ |
||
47 | private $canonicalId = ''; |
||
48 | |||
49 | /** |
||
50 | * @var string error code |
||
51 | */ |
||
52 | private $error = ''; |
||
53 | |||
54 | /** |
||
55 | * Error code setter |
||
56 | * @param string $error error code |
||
57 | * @return Status self |
||
58 | */ |
||
59 | 3 | public function setError($error) { |
|
63 | |||
64 | /** |
||
65 | * Error code getter |
||
66 | * @return string error code |
||
67 | */ |
||
68 | 4 | public function getError() { |
|
71 | |||
72 | /** |
||
73 | * Message identifier setter |
||
74 | * @param string $messageId message identifier |
||
75 | * @return Status self |
||
76 | */ |
||
77 | 4 | public function setMessageId($messageId) { |
|
81 | |||
82 | /** |
||
83 | * Message identifier getter |
||
84 | * @return string message identifier |
||
85 | */ |
||
86 | 3 | public function getMessageId() { |
|
89 | |||
90 | /** |
||
91 | * Canonical identifier setter |
||
92 | * @param string $registrationId canonical identifier |
||
93 | * @return Status self |
||
94 | */ |
||
95 | 4 | public function setCanonicalId($registrationId) { |
|
99 | |||
100 | /** |
||
101 | * Canonical identifier getter |
||
102 | * @return string canonical identifier |
||
103 | */ |
||
104 | 3 | public function getCanonicalId() { |
|
107 | |||
108 | /** |
||
109 | * Check status for new device registration identifier |
||
110 | * @return bool true when status has new device registration identifier |
||
111 | */ |
||
112 | 3 | public function hasCanonicalId() { |
|
115 | |||
116 | /** |
||
117 | * Check status for need to remove device registration identifier |
||
118 | * @return bool true when need to remove device registration identifier |
||
119 | */ |
||
120 | 3 | public function mustRemove() { |
|
123 | |||
124 | /** |
||
125 | * Check status for can to retry message sending |
||
126 | * @return bool true when can to retry message sending |
||
127 | */ |
||
128 | 3 | public function canRetry() { |
|
132 | } |
||
133 |