@@ -87,7 +87,7 @@ |
||
87 | 87 | // Get container builder |
88 | 88 | $builder = $this->getContainerBuilder(); |
89 | 89 | |
90 | - // Set the default configuration |
|
90 | + // Set the default configuration |
|
91 | 91 | $this->validateConfig($this->defaults); |
92 | 92 | |
93 | 93 | // Get extension configuration |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @date 21.04.14 |
13 | 13 | */ |
14 | 14 | |
15 | -declare(strict_types = 1); |
|
15 | +declare(strict_types=1); |
|
16 | 16 | |
17 | 17 | namespace IPub\MobileDetect\DI; |
18 | 18 | |
@@ -47,19 +47,19 @@ discard block |
||
47 | 47 | 'isEnabled' => false, |
48 | 48 | 'host' => null, |
49 | 49 | 'statusCode' => 301, |
50 | - 'action' => 'noRedirect', // redirect/noRedirect/redirectWithoutPath |
|
50 | + 'action' => 'noRedirect', // redirect/noRedirect/redirectWithoutPath |
|
51 | 51 | ], |
52 | 52 | 'phone' => [ |
53 | 53 | 'isEnabled' => false, |
54 | 54 | 'host' => null, |
55 | 55 | 'statusCode' => 301, |
56 | - 'action' => 'noRedirect', // redirect/noRedirect/redirectWithoutPath |
|
56 | + 'action' => 'noRedirect', // redirect/noRedirect/redirectWithoutPath |
|
57 | 57 | ], |
58 | 58 | 'tablet' => [ |
59 | 59 | 'isEnabled' => false, |
60 | 60 | 'host' => null, |
61 | 61 | 'statusCode' => 301, |
62 | - 'action' => 'noRedirect', // redirect/noRedirect/redirectWithoutPath |
|
62 | + 'action' => 'noRedirect', // redirect/noRedirect/redirectWithoutPath |
|
63 | 63 | ], |
64 | 64 | 'detectPhoneAsMobile' => false, |
65 | 65 | 'detectTabletAsMobile' => false, |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | ->setAutowired(FALSE); |
134 | 134 | |
135 | 135 | $application = $builder->getDefinition('application'); |
136 | - $application->addSetup('$service->onRequest[] = ?', ['@' . $this->prefix('onRequestHandler')]); |
|
137 | - $application->addSetup('$service->onResponse[] = ?', ['@' . $this->prefix('onResponseHandler')]); |
|
136 | + $application->addSetup('$service->onRequest[] = ?', ['@'.$this->prefix('onRequestHandler')]); |
|
137 | + $application->addSetup('$service->onResponse[] = ?', ['@'.$this->prefix('onResponseHandler')]); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -44,37 +44,37 @@ |
||
44 | 44 | private $defaults = [ |
45 | 45 | 'redirect' => [ |
46 | 46 | 'mobile' => [ |
47 | - 'isEnabled' => false, |
|
48 | - 'host' => null, |
|
47 | + 'isEnabled' => FALSE, |
|
48 | + 'host' => NULL, |
|
49 | 49 | 'statusCode' => 301, |
50 | 50 | 'action' => 'noRedirect', // redirect/noRedirect/redirectWithoutPath |
51 | 51 | ], |
52 | 52 | 'phone' => [ |
53 | - 'isEnabled' => false, |
|
54 | - 'host' => null, |
|
53 | + 'isEnabled' => FALSE, |
|
54 | + 'host' => NULL, |
|
55 | 55 | 'statusCode' => 301, |
56 | 56 | 'action' => 'noRedirect', // redirect/noRedirect/redirectWithoutPath |
57 | 57 | ], |
58 | 58 | 'tablet' => [ |
59 | - 'isEnabled' => false, |
|
60 | - 'host' => null, |
|
59 | + 'isEnabled' => FALSE, |
|
60 | + 'host' => NULL, |
|
61 | 61 | 'statusCode' => 301, |
62 | 62 | 'action' => 'noRedirect', // redirect/noRedirect/redirectWithoutPath |
63 | 63 | ], |
64 | - 'detectPhoneAsMobile' => false, |
|
65 | - 'detectTabletAsMobile' => false, |
|
64 | + 'detectPhoneAsMobile' => FALSE, |
|
65 | + 'detectTabletAsMobile' => FALSE, |
|
66 | 66 | ], |
67 | 67 | 'switchDeviceView' => [ |
68 | - 'saveRefererPath' => true |
|
68 | + 'saveRefererPath' => TRUE |
|
69 | 69 | ], |
70 | 70 | 'switchParameterName' => 'device_view', |
71 | 71 | 'deviceViewCookie' => [ |
72 | 72 | 'name' => 'device_view', |
73 | - 'domain' => null, |
|
73 | + 'domain' => NULL, |
|
74 | 74 | 'expireAfter' => '+1 month', |
75 | 75 | 'path' => '/', |
76 | - 'secure' => false, |
|
77 | - 'httpOnly' => true, |
|
76 | + 'secure' => FALSE, |
|
77 | + 'httpOnly' => TRUE, |
|
78 | 78 | ], |
79 | 79 | 'debugger' => '%debugMode%' |
80 | 80 | ]; |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @date 22.04.14 |
13 | 13 | */ |
14 | 14 | |
15 | -declare(strict_types = 1); |
|
15 | +declare(strict_types=1); |
|
16 | 16 | |
17 | 17 | namespace IPub\MobileDetect\Events; |
18 | 18 | |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | $url->setQueryParameter($this->deviceView->getSwitchParameterName(), null); |
380 | 380 | |
381 | 381 | // Create full path url |
382 | - $redirectUrl = $this->getCurrentHost() . $url->getRelativeUrl(); |
|
382 | + $redirectUrl = $this->getCurrentHost().$url->getRelativeUrl(); |
|
383 | 383 | |
384 | 384 | // Generate only domain path |
385 | 385 | } else { |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | if ($routingOption = $this->getRoutingOption($platform)) { |
421 | 421 | switch ($routingOption) { |
422 | 422 | case self::REDIRECT: |
423 | - return rtrim($this->redirectConf[$platform]['host'], '/') . '/' . ltrim($this->httpRequest->getUrl()->getRelativeUrl(), '/'); |
|
423 | + return rtrim($this->redirectConf[$platform]['host'], '/').'/'.ltrim($this->httpRequest->getUrl()->getRelativeUrl(), '/'); |
|
424 | 424 | |
425 | 425 | case self::REDIRECT_WITHOUT_PATH: |
426 | 426 | return $this->redirectConf[$platform]['host']; |
@@ -467,6 +467,6 @@ discard block |
||
467 | 467 | */ |
468 | 468 | private function getCurrentHost() : string |
469 | 469 | { |
470 | - return $this->httpRequest->getUrl()->getHostUrl() . $this->httpRequest->getUrl()->getScriptPath(); |
|
470 | + return $this->httpRequest->getUrl()->getHostUrl().$this->httpRequest->getUrl()->getScriptPath(); |
|
471 | 471 | } |
472 | 472 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | /** |
50 | 50 | * @var bool |
51 | 51 | */ |
52 | - public $isFullPath = true; |
|
52 | + public $isFullPath = TRUE; |
|
53 | 53 | |
54 | 54 | /** |
55 | 55 | * @var Http\IRequest |
@@ -207,27 +207,27 @@ discard block |
||
207 | 207 | private function hasPhoneRedirect() : bool |
208 | 208 | { |
209 | 209 | if (!$this->redirectConf['phone']['isEnabled']) { |
210 | - return false; |
|
210 | + return FALSE; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | $isPhone = $this->mobileDetect->isPhone(); |
214 | 214 | |
215 | - if ($this->redirectConf['detectPhoneAsMobile'] === false) { |
|
215 | + if ($this->redirectConf['detectPhoneAsMobile'] === FALSE) { |
|
216 | 216 | $isPhoneHost = ($this->getCurrentHost() === $this->redirectConf['phone']['host']); |
217 | 217 | |
218 | 218 | if ($isPhone && !$isPhoneHost && ($this->getRoutingOption(self::PHONE) != self::NO_REDIRECT)) { |
219 | - return true; |
|
219 | + return TRUE; |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | } else { |
223 | 223 | $isMobileHost = ($this->getCurrentHost() === $this->redirectConf['mobile']['host']); |
224 | 224 | |
225 | 225 | if ($isPhone && !$isMobileHost && ($this->getRoutingOption(self::PHONE) != self::NO_REDIRECT)) { |
226 | - return true; |
|
226 | + return TRUE; |
|
227 | 227 | } |
228 | 228 | } |
229 | 229 | |
230 | - return false; |
|
230 | + return FALSE; |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -238,27 +238,27 @@ discard block |
||
238 | 238 | private function hasTabletRedirect() : bool |
239 | 239 | { |
240 | 240 | if (!$this->redirectConf['tablet']['isEnabled']) { |
241 | - return false; |
|
241 | + return FALSE; |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | $isTablet = $this->mobileDetect->isTablet(); |
245 | 245 | |
246 | - if ($this->redirectConf['detectTabletAsMobile'] === false) { |
|
246 | + if ($this->redirectConf['detectTabletAsMobile'] === FALSE) { |
|
247 | 247 | $isTabletHost = ($this->getCurrentHost() === $this->redirectConf['tablet']['host']); |
248 | 248 | |
249 | 249 | if ($isTablet && !$isTabletHost && ($this->getRoutingOption(self::TABLET) != self::NO_REDIRECT)) { |
250 | - return true; |
|
250 | + return TRUE; |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | } else { |
254 | 254 | $isMobileHost = ($this->getCurrentHost() === $this->redirectConf['mobile']['host']); |
255 | 255 | |
256 | 256 | if ($isTablet && !$isMobileHost && ($this->getRoutingOption(self::TABLET) != self::NO_REDIRECT)) { |
257 | - return true; |
|
257 | + return TRUE; |
|
258 | 258 | } |
259 | 259 | } |
260 | 260 | |
261 | - return false; |
|
261 | + return FALSE; |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | /** |
@@ -269,13 +269,13 @@ discard block |
||
269 | 269 | private function hasMobileRedirect() : bool |
270 | 270 | { |
271 | 271 | if (!$this->redirectConf['mobile']['isEnabled']) { |
272 | - return false; |
|
272 | + return FALSE; |
|
273 | 273 | } |
274 | 274 | |
275 | - if ($this->redirectConf['detectPhoneAsMobile'] === false) { |
|
275 | + if ($this->redirectConf['detectPhoneAsMobile'] === FALSE) { |
|
276 | 276 | $isMobile = ($this->mobileDetect->isTablet() || ($this->mobileDetect->isMobile()) && !$this->mobileDetect->isPhone()); |
277 | 277 | |
278 | - } elseif ($this->redirectConf['detectTabletAsMobile'] === false) { |
|
278 | + } elseif ($this->redirectConf['detectTabletAsMobile'] === FALSE) { |
|
279 | 279 | $isMobile = ($this->mobileDetect->isPhone() || ($this->mobileDetect->isMobile()) && !$this->mobileDetect->isTablet()); |
280 | 280 | |
281 | 281 | } else { |
@@ -285,10 +285,10 @@ discard block |
||
285 | 285 | $isMobileHost = ($this->getCurrentHost() === $this->redirectConf['mobile']['host']); |
286 | 286 | |
287 | 287 | if ($isMobile && !$isMobileHost && ($this->getRoutingOption(self::MOBILE) != self::NO_REDIRECT)) { |
288 | - return true; |
|
288 | + return TRUE; |
|
289 | 289 | } |
290 | 290 | |
291 | - return false; |
|
291 | + return FALSE; |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | /** |
@@ -298,15 +298,15 @@ discard block |
||
298 | 298 | */ |
299 | 299 | private function needPhoneResponseModify() : bool |
300 | 300 | { |
301 | - if (($this->deviceView->getViewType() === null || $this->deviceView->isPhoneView()) && $this->mobileDetect->isMobile() && !$this->mobileDetect->isTablet()) { |
|
301 | + if (($this->deviceView->getViewType() === NULL || $this->deviceView->isPhoneView()) && $this->mobileDetect->isMobile() && !$this->mobileDetect->isTablet()) { |
|
302 | 302 | $this->onResponseHandler->modifyResponseClosure = function (Helpers\DeviceView $deviceView) : Http\IResponse { |
303 | 303 | return $deviceView->modifyPhoneResponse(); |
304 | 304 | }; |
305 | 305 | |
306 | - return true; |
|
306 | + return TRUE; |
|
307 | 307 | } |
308 | 308 | |
309 | - return false; |
|
309 | + return FALSE; |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | /** |
@@ -316,15 +316,15 @@ discard block |
||
316 | 316 | */ |
317 | 317 | private function needTabletResponseModify() : bool |
318 | 318 | { |
319 | - if (($this->deviceView->getViewType() === null || $this->deviceView->isTabletView()) && $this->mobileDetect->isTablet()) { |
|
319 | + if (($this->deviceView->getViewType() === NULL || $this->deviceView->isTabletView()) && $this->mobileDetect->isTablet()) { |
|
320 | 320 | $this->onResponseHandler->modifyResponseClosure = function (Helpers\DeviceView $deviceView) : Http\IResponse { |
321 | 321 | return $deviceView->modifyTabletResponse(); |
322 | 322 | }; |
323 | 323 | |
324 | - return true; |
|
324 | + return TRUE; |
|
325 | 325 | } |
326 | 326 | |
327 | - return false; |
|
327 | + return FALSE; |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | /** |
@@ -334,15 +334,15 @@ discard block |
||
334 | 334 | */ |
335 | 335 | private function needMobileResponseModify() : bool |
336 | 336 | { |
337 | - if (($this->deviceView->getViewType() === null || $this->deviceView->isMobileView()) && $this->mobileDetect->isMobile()) { |
|
337 | + if (($this->deviceView->getViewType() === NULL || $this->deviceView->isMobileView()) && $this->mobileDetect->isMobile()) { |
|
338 | 338 | $this->onResponseHandler->modifyResponseClosure = function (Helpers\DeviceView $deviceView) : Http\IResponse { |
339 | 339 | return $deviceView->modifyMobileResponse(); |
340 | 340 | }; |
341 | 341 | |
342 | - return true; |
|
342 | + return TRUE; |
|
343 | 343 | } |
344 | 344 | |
345 | - return false; |
|
345 | + return FALSE; |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | /** |
@@ -352,15 +352,15 @@ discard block |
||
352 | 352 | */ |
353 | 353 | private function needNotMobileResponseModify() : bool |
354 | 354 | { |
355 | - if ($this->deviceView->getViewType() === null || $this->deviceView->isNotMobileView()) { |
|
355 | + if ($this->deviceView->getViewType() === NULL || $this->deviceView->isNotMobileView()) { |
|
356 | 356 | $this->onResponseHandler->modifyResponseClosure = function (Helpers\DeviceView $deviceView) : Http\IResponse { |
357 | 357 | return $deviceView->modifyNotMobileResponse(); |
358 | 358 | }; |
359 | 359 | |
360 | - return true; |
|
360 | + return TRUE; |
|
361 | 361 | } |
362 | 362 | |
363 | - return false; |
|
363 | + return FALSE; |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | /** |
@@ -371,12 +371,12 @@ discard block |
||
371 | 371 | private function getRedirectResponseBySwitchParam() : Responses\RedirectResponse |
372 | 372 | { |
373 | 373 | // Generate full url path |
374 | - if ($this->isFullPath === true) { |
|
374 | + if ($this->isFullPath === TRUE) { |
|
375 | 375 | // Get actual url |
376 | 376 | $url = $this->httpRequest->getUrl(); |
377 | 377 | |
378 | 378 | // Remove switch param |
379 | - $url->setQueryParameter($this->deviceView->getSwitchParameterName(), null); |
|
379 | + $url->setQueryParameter($this->deviceView->getSwitchParameterName(), NULL); |
|
380 | 380 | |
381 | 381 | // Create full path url |
382 | 382 | $redirectUrl = $this->getCurrentHost() . $url->getRelativeUrl(); |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | ); |
406 | 406 | } |
407 | 407 | |
408 | - return null; |
|
408 | + return NULL; |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | /** |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | } |
428 | 428 | } |
429 | 429 | |
430 | - return null; |
|
430 | + return NULL; |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | /** |
@@ -439,14 +439,14 @@ discard block |
||
439 | 439 | */ |
440 | 440 | private function getRoutingOption(string $name) : ?string |
441 | 441 | { |
442 | - $option = null; |
|
442 | + $option = NULL; |
|
443 | 443 | |
444 | 444 | // Get actual route |
445 | 445 | $request = $this->router->match($this->httpRequest); |
446 | 446 | |
447 | 447 | if ($request instanceof Application\Request) { |
448 | 448 | $params = $request->getParameters(); |
449 | - $option = isset($params[$name]) ? $params[$name] : null; |
|
449 | + $option = isset($params[$name]) ? $params[$name] : NULL; |
|
450 | 450 | } |
451 | 451 | |
452 | 452 | if (!$option) { |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | return $option; |
458 | 458 | } |
459 | 459 | |
460 | - return null; |
|
460 | + return NULL; |
|
461 | 461 | } |
462 | 462 | |
463 | 463 | /** |
@@ -12,7 +12,7 @@ |
||
12 | 12 | * @date 23.04.14 |
13 | 13 | */ |
14 | 14 | |
15 | -declare(strict_types = 1); |
|
15 | +declare(strict_types=1); |
|
16 | 16 | |
17 | 17 | namespace IPub\MobileDetect\Events; |
18 | 18 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | /** |
34 | 34 | * @var bool |
35 | 35 | */ |
36 | - private $needModifyResponse = false; |
|
36 | + private $needModifyResponse = FALSE; |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * @var DeviceView |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function needModifyResponse() : void |
62 | 62 | { |
63 | - $this->needModifyResponse = true; |
|
63 | + $this->needModifyResponse = TRUE; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @date 23.04.14 |
13 | 13 | */ |
14 | 14 | |
15 | -declare(strict_types = 1); |
|
15 | +declare(strict_types=1); |
|
16 | 16 | |
17 | 17 | namespace IPub\MobileDetect\Helpers; |
18 | 18 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @throws Exceptions\InvalidArgumentException |
77 | 77 | */ |
78 | - public function __construct(string $name, ?string $domain = null, ?string $expireAfter = null, string $path = '/', bool $secure = false, bool $httpOnly = true) |
|
78 | + public function __construct(string $name, ?string $domain = null, ?string $expireAfter = null, string $path = '/', bool $secure = false, bool $httpOnly = true) |
|
79 | 79 | { |
80 | 80 | // from PHP source code |
81 | 81 | if (preg_match("/[=,; \t\r\n\013\014]/", $name)) { |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @throws Exceptions\InvalidArgumentException |
77 | 77 | */ |
78 | - public function __construct(string $name, ?string $domain = null, ?string $expireAfter = null, string $path = '/', bool $secure = false, bool $httpOnly = true) |
|
78 | + public function __construct(string $name, ?string $domain = NULL, ?string $expireAfter = NULL, string $path = '/', bool $secure = FALSE, bool $httpOnly = TRUE) |
|
79 | 79 | { |
80 | 80 | // from PHP source code |
81 | 81 | if (preg_match("/[=,; \t\r\n\013\014]/", $name)) { |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | $expire = new \DateTime; |
90 | 90 | |
91 | - if ($expireAfter !== null) { |
|
91 | + if ($expireAfter !== NULL) { |
|
92 | 92 | $expire->modify($expireAfter); |
93 | 93 | } |
94 | 94 |
@@ -12,7 +12,7 @@ |
||
12 | 12 | * @date 23.04.14 |
13 | 13 | */ |
14 | 14 | |
15 | -declare(strict_types = 1); |
|
15 | +declare(strict_types=1); |
|
16 | 16 | |
17 | 17 | namespace IPub\MobileDetect\Helpers; |
18 | 18 |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | $this->switchParameterName = $setSwitchParameterName; |
82 | 82 | |
83 | - if ($this->httpRequest->getQuery($this->switchParameterName) ?? false) { |
|
83 | + if ($this->httpRequest->getQuery($this->switchParameterName) ?? FALSE) { |
|
84 | 84 | $this->viewType = $this->httpRequest->getQuery($this->switchParameterName); |
85 | 85 | |
86 | 86 | } elseif ($this->httpRequest->getCookie($this->cookieSettings->getName())) { |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | */ |
214 | 214 | public function hasSwitchParameter() : bool |
215 | 215 | { |
216 | - return ($this->httpRequest->getQuery($this->switchParameterName) ?? false) ? true : false; |
|
216 | + return ($this->httpRequest->getQuery($this->switchParameterName) ?? FALSE) ? TRUE : FALSE; |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | /** |