1 | <?php |
||
16 | class Result implements \JsonSerializable |
||
17 | { |
||
18 | const STATUS_SUCCESS = 'success'; |
||
19 | const STATUS_INVALID_DEVICE = 'invalidDevice'; |
||
20 | const STATUS_INVALID_MESSAGE = 'invalidMessage'; |
||
21 | const STATUS_RATE_ERROR = 'rateError'; |
||
22 | const STATUS_AUTH_ERROR = 'authError'; |
||
23 | const STATUS_SERVER_ERROR = 'serverError'; |
||
24 | const STATUS_UNKNOWN_ERROR = 'unknownError'; |
||
25 | |||
26 | /** |
||
27 | * Device token. |
||
28 | * |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $token; |
||
32 | |||
33 | /** |
||
34 | * Result time. |
||
35 | * |
||
36 | * @var \DateTime |
||
37 | */ |
||
38 | protected $date; |
||
39 | |||
40 | /** |
||
41 | * Result status. |
||
42 | * |
||
43 | * @var string |
||
44 | */ |
||
45 | protected $status; |
||
46 | |||
47 | /** |
||
48 | * Result status message. |
||
49 | * |
||
50 | * @var string |
||
51 | */ |
||
52 | protected $statusMessage; |
||
53 | |||
54 | /** |
||
55 | * @param string $token |
||
56 | * @param \DateTime $date |
||
57 | * @param string $status |
||
58 | * @param string $statusMessage |
||
|
|||
59 | * |
||
60 | * @throws \InvalidArgumentException |
||
61 | */ |
||
62 | public function __construct( |
||
73 | |||
74 | /** |
||
75 | * Retrieve result device token. |
||
76 | * |
||
77 | * @return string |
||
78 | */ |
||
79 | public function getToken() |
||
83 | |||
84 | /** |
||
85 | * Set result device token. |
||
86 | * |
||
87 | * @param string $token |
||
88 | * |
||
89 | * @return $this |
||
90 | */ |
||
91 | public function setToken($token) |
||
97 | |||
98 | /** |
||
99 | * Retrieve result time. |
||
100 | * |
||
101 | * @return \DateTime |
||
102 | */ |
||
103 | public function getDate() |
||
107 | |||
108 | /** |
||
109 | * Set result time. |
||
110 | * |
||
111 | * @param \DateTime $date |
||
112 | * |
||
113 | * @return $this |
||
114 | */ |
||
115 | public function setDate(\DateTime $date) |
||
121 | |||
122 | /** |
||
123 | * Retrieve result status. |
||
124 | * |
||
125 | * @return string |
||
126 | */ |
||
127 | public function getStatus() |
||
131 | |||
132 | /** |
||
133 | * Check successful status. |
||
134 | * |
||
135 | * @return bool |
||
136 | */ |
||
137 | public function isSuccess() |
||
141 | |||
142 | /** |
||
143 | * Check error status. |
||
144 | * |
||
145 | * @return bool |
||
146 | */ |
||
147 | public function isError() |
||
151 | |||
152 | /** |
||
153 | * Set result status. |
||
154 | * |
||
155 | * @param string $status |
||
156 | * |
||
157 | * @throws \InvalidArgumentException |
||
158 | * |
||
159 | * @return $this |
||
160 | */ |
||
161 | public function setStatus($status) |
||
172 | |||
173 | /** |
||
174 | * Retrieve result status message. |
||
175 | * |
||
176 | * @return string |
||
177 | */ |
||
178 | public function getStatusMessage() |
||
182 | |||
183 | /** |
||
184 | * Check successful status message. |
||
185 | * |
||
186 | * @param string $statusMessage |
||
187 | * |
||
188 | * @return $this |
||
189 | */ |
||
190 | public function setStatusMessage($statusMessage = null) |
||
196 | |||
197 | /** |
||
198 | * {@inheritdoc} |
||
199 | * |
||
200 | * @return string[] |
||
201 | */ |
||
202 | public function jsonSerialize() |
||
211 | } |
||
212 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.