1111
1212namespace SunCat \MobileDetectBundle \DataCollector ;
1313
14- use Exception ;
1514use SunCat \MobileDetectBundle \EventListener \RequestResponseListener ;
1615use SunCat \MobileDetectBundle \Helper \DeviceView ;
1716use Symfony \Component \HttpFoundation \Request ;
@@ -50,9 +49,9 @@ public function __construct(DeviceView $deviceView)
5049 /**
5150 * Collects data for the given Request and Response.
5251 *
53- * @param Request $request A Request instance
54- * @param Response $response A Response instance
55- * @param Exception $exception An Exception instance
52+ * @param Request $request A Request instance
53+ * @param Response $response A Response instance
54+ * @param Throwable|null $exception An Exception instance
5655 *
5756 * @api
5857 */
@@ -96,25 +95,17 @@ public function collect(
9695 );
9796 }
9897
99- /**
100- * @return string
101- */
98+
10299 public function getCurrentView (): string
103100 {
104101 return $ this ->data ['currentView ' ];
105102 }
106103
107- /**
108- * @return array
109- */
110104 public function getViews (): array
111105 {
112106 return $ this ->data ['views ' ];
113107 }
114108
115- /**
116- * @param array $redirectConfig
117- */
118109 public function setRedirectConfig (array $ redirectConfig )
119110 {
120111 $ this ->redirectConfig = $ redirectConfig ;
@@ -123,22 +114,14 @@ public function setRedirectConfig(array $redirectConfig)
123114 /**
124115 * Returns the name of the collector.
125116 *
126- * @return string The collector name
127- *
128117 * @api
129118 */
130119 public function getName (): string
131120 {
132121 return 'device.collector ' ;
133122 }
134123
135- /**
136- * @param $view
137- * @param $host
138- *
139- * @return bool
140- */
141- protected function canUseView ($ view , $ host ): bool
124+ protected function canUseView (string $ view , ?string $ host ): bool
142125 {
143126 if (!is_array ($ this ->redirectConfig )) {
144127 return true ;
@@ -174,17 +157,11 @@ protected function canUseView($view, $host): bool
174157 return true ;
175158 }
176159
177- /**
178- * @param Request $request
179- * @param $view
180- *
181- * @return string
182- */
183- private function generateSwitchLink (
184- Request $ request ,
185- $ view
186- ) {
160+
161+ private function generateSwitchLink (Request $ request , string $ view ): ?string
162+ {
187163 $ requestSwitchView = $ request ->duplicate ();
164+
188165 $ requestSwitchView ->query ->set ($ this ->deviceView ->getSwitchParam (), $ view );
189166 $ requestSwitchView ->server ->set (
190167 'QUERY_STRING ' ,
0 commit comments