comparison vendor/zendframework/zend-feed/src/PubSubHubbub/Subscriber/Callback.php @ 2:5311817fb629

Theme updates
author Chris Cannam
date Tue, 10 Jul 2018 13:19:18 +0000
parents c75dbcec494b
children
comparison
equal deleted inserted replaced
1:0b0e5f3b1e83 2:5311817fb629
145 'hub_topic', 145 'hub_topic',
146 'hub_challenge', 146 'hub_challenge',
147 'hub_verify_token', 147 'hub_verify_token',
148 ]; 148 ];
149 foreach ($required as $key) { 149 foreach ($required as $key) {
150 if (!array_key_exists($key, $httpGetData)) { 150 if (! array_key_exists($key, $httpGetData)) {
151 return false; 151 return false;
152 } 152 }
153 } 153 }
154 if ($httpGetData['hub_mode'] !== 'subscribe' 154 if ($httpGetData['hub_mode'] !== 'subscribe'
155 && $httpGetData['hub_mode'] !== 'unsubscribe' 155 && $httpGetData['hub_mode'] !== 'unsubscribe'
156 ) { 156 ) {
157 return false; 157 return false;
158 } 158 }
159 if ($httpGetData['hub_mode'] == 'subscribe' 159 if ($httpGetData['hub_mode'] == 'subscribe'
160 && !array_key_exists('hub_lease_seconds', $httpGetData) 160 && ! array_key_exists('hub_lease_seconds', $httpGetData)
161 ) { 161 ) {
162 return false; 162 return false;
163 } 163 }
164 if (!Uri::factory($httpGetData['hub_topic'])->isValid()) { 164 if (! Uri::factory($httpGetData['hub_topic'])->isValid()) {
165 return false; 165 return false;
166 } 166 }
167 167
168 /** 168 /**
169 * Attempt to retrieve any Verification Token Key attached to Callback 169 * Attempt to retrieve any Verification Token Key attached to Callback
170 * URL's path by our Subscriber implementation 170 * URL's path by our Subscriber implementation
171 */ 171 */
172 if (!$this->_hasValidVerifyToken($httpGetData)) { 172 if (! $this->_hasValidVerifyToken($httpGetData)) {
173 return false; 173 return false;
174 } 174 }
175 return true; 175 return true;
176 } 176 }
177 177
218 * 218 *
219 * @param array $httpGetData 219 * @param array $httpGetData
220 * @param bool $checkValue 220 * @param bool $checkValue
221 * @return bool 221 * @return bool
222 */ 222 */
223 // @codingStandardsIgnoreStart
223 protected function _hasValidVerifyToken(array $httpGetData = null, $checkValue = true) 224 protected function _hasValidVerifyToken(array $httpGetData = null, $checkValue = true)
224 { 225 {
226 // @codingStandardsIgnoreEnd
225 $verifyTokenKey = $this->_detectVerifyTokenKey($httpGetData); 227 $verifyTokenKey = $this->_detectVerifyTokenKey($httpGetData);
226 if (empty($verifyTokenKey)) { 228 if (empty($verifyTokenKey)) {
227 return false; 229 return false;
228 } 230 }
229 $verifyTokenExists = $this->getStorage()->hasSubscription($verifyTokenKey); 231 $verifyTokenExists = $this->getStorage()->hasSubscription($verifyTokenKey);
230 if (!$verifyTokenExists) { 232 if (! $verifyTokenExists) {
231 return false; 233 return false;
232 } 234 }
233 if ($checkValue) { 235 if ($checkValue) {
234 $data = $this->getStorage()->getSubscription($verifyTokenKey); 236 $data = $this->getStorage()->getSubscription($verifyTokenKey);
235 $verifyToken = $data['verify_token']; 237 $verifyToken = $data['verify_token'];
248 * path part (the last part by convention). 250 * path part (the last part by convention).
249 * 251 *
250 * @param null|array $httpGetData 252 * @param null|array $httpGetData
251 * @return false|string 253 * @return false|string
252 */ 254 */
255 // @codingStandardsIgnoreStart
253 protected function _detectVerifyTokenKey(array $httpGetData = null) 256 protected function _detectVerifyTokenKey(array $httpGetData = null)
254 { 257 {
258 // @codingStandardsIgnoreEnd
255 /** 259 /**
256 * Available when sub keys encoding in Callback URL path 260 * Available when sub keys encoding in Callback URL path
257 */ 261 */
258 if (isset($this->subscriptionKey)) { 262 if (isset($this->subscriptionKey)) {
259 return $this->subscriptionKey; 263 return $this->subscriptionKey;
284 * This bypasses $_GET which munges parameter names and cannot accept 288 * This bypasses $_GET which munges parameter names and cannot accept
285 * multiple parameters with the same key. 289 * multiple parameters with the same key.
286 * 290 *
287 * @return array|void 291 * @return array|void
288 */ 292 */
293 // @codingStandardsIgnoreStart
289 protected function _parseQueryString() 294 protected function _parseQueryString()
290 { 295 {
296 // @codingStandardsIgnoreEnd
291 $params = []; 297 $params = [];
292 $queryString = ''; 298 $queryString = '';
293 if (isset($_SERVER['QUERY_STRING'])) { 299 if (isset($_SERVER['QUERY_STRING'])) {
294 $queryString = $_SERVER['QUERY_STRING']; 300 $queryString = $_SERVER['QUERY_STRING'];
295 } 301 }