44 *
55 * @copyright More in license.md
66 * @license https://www.ipublikuj.eu
7- * @author Adam Kadlec https://www. ipublikuj.eu
7+ * @author Adam Kadlec <adam.kadlec@ ipublikuj.eu>
88 * @package iPublikuj:MobileDetect!
99 * @subpackage Events
1010 * @since 1.0.0
@@ -299,7 +299,7 @@ private function hasMobileRedirect() : bool
299299 private function needPhoneResponseModify () : bool
300300 {
301301 if (($ this ->deviceView ->getViewType () === NULL || $ this ->deviceView ->isPhoneView ()) && $ this ->mobileDetect ->isMobile () && !$ this ->mobileDetect ->isTablet ()) {
302- $ this ->onResponseHandler ->modifyResponseClosure = function ($ deviceView ) {
302+ $ this ->onResponseHandler ->modifyResponseClosure = function (Helpers \ DeviceView $ deviceView ) : Http \ IResponse {
303303 return $ deviceView ->modifyPhoneResponse ();
304304 };
305305
@@ -317,7 +317,7 @@ private function needPhoneResponseModify() : bool
317317 private function needTabletResponseModify () : bool
318318 {
319319 if (($ this ->deviceView ->getViewType () === NULL || $ this ->deviceView ->isTabletView ()) && $ this ->mobileDetect ->isTablet ()) {
320- $ this ->onResponseHandler ->modifyResponseClosure = function (Helpers \DeviceView $ deviceView ) {
320+ $ this ->onResponseHandler ->modifyResponseClosure = function (Helpers \DeviceView $ deviceView ) : Http \ IResponse {
321321 return $ deviceView ->modifyTabletResponse ();
322322 };
323323
@@ -335,7 +335,7 @@ private function needTabletResponseModify() : bool
335335 private function needMobileResponseModify () : bool
336336 {
337337 if (($ this ->deviceView ->getViewType () === NULL || $ this ->deviceView ->isMobileView ()) && $ this ->mobileDetect ->isMobile ()) {
338- $ this ->onResponseHandler ->modifyResponseClosure = function (Helpers \DeviceView $ deviceView ) {
338+ $ this ->onResponseHandler ->modifyResponseClosure = function (Helpers \DeviceView $ deviceView ) : Http \ IResponse {
339339 return $ deviceView ->modifyMobileResponse ();
340340 };
341341
@@ -353,7 +353,7 @@ private function needMobileResponseModify() : bool
353353 private function needNotMobileResponseModify () : bool
354354 {
355355 if ($ this ->deviceView ->getViewType () === NULL || $ this ->deviceView ->isNotMobileView ()) {
356- $ this ->onResponseHandler ->modifyResponseClosure = function (Helpers \DeviceView $ deviceView ) {
356+ $ this ->onResponseHandler ->modifyResponseClosure = function (Helpers \DeviceView $ deviceView ) : Http \ IResponse {
357357 return $ deviceView ->modifyNotMobileResponse ();
358358 };
359359
@@ -391,29 +391,31 @@ private function getRedirectResponseBySwitchParam() : Responses\RedirectResponse
391391
392392 /**
393393 * Gets the device RedirectResponse
394- *
394+ *
395395 * @param string $device
396396 *
397- * @return Responses\RedirectResponse
397+ * @return Responses\RedirectResponse|NULL
398398 */
399- private function getDeviceRedirectResponse (string $ device ) : Responses \RedirectResponse
399+ private function getDeviceRedirectResponse (string $ device ) : ? Responses \RedirectResponse
400400 {
401401 if ($ host = $ this ->getRedirectUrl ($ device )) {
402402 return $ this ->deviceView ->getMobileRedirectResponse (
403403 $ host ,
404404 $ this ->redirectConf [$ device ]['statusCode ' ]
405405 );
406406 }
407+
408+ return NULL ;
407409 }
408410
409411 /**
410412 * Gets the redirect url
411413 *
412414 * @param string $platform
413415 *
414- * @return string
416+ * @return string|NULL
415417 */
416- private function getRedirectUrl (string $ platform ) : string
418+ private function getRedirectUrl (string $ platform ) : ? string
417419 {
418420 if ($ routingOption = $ this ->getRoutingOption ($ platform )) {
419421 switch ($ routingOption ) {
@@ -424,6 +426,8 @@ private function getRedirectUrl(string $platform) : string
424426 return $ this ->redirectConf [$ platform ]['host ' ];
425427 }
426428 }
429+
430+ return NULL ;
427431 }
428432
429433 /**
0 commit comments