1 | <?php |
||
19 | class DeviceDetector implements Detector |
||
20 | { |
||
21 | /* ----------------------------------------------------------------- |
||
22 | | Properties |
||
23 | | ----------------------------------------------------------------- |
||
24 | */ |
||
25 | |||
26 | /** @var \DeviceDetector\DeviceDetector */ |
||
27 | protected $detector; |
||
28 | |||
29 | /* ----------------------------------------------------------------- |
||
30 | | Main Methods |
||
31 | | ----------------------------------------------------------------- |
||
32 | */ |
||
33 | |||
34 | /** |
||
35 | * Handle the given request. |
||
36 | * |
||
37 | * @param \Illuminate\Http\Request $request |
||
38 | * |
||
39 | * @return $this |
||
40 | */ |
||
41 | 372 | public function handle(Request $request): Detector |
|
51 | |||
52 | /* ----------------------------------------------------------------- |
||
53 | | Accessors |
||
54 | | ----------------------------------------------------------------- |
||
55 | */ |
||
56 | |||
57 | /** |
||
58 | * Get the OS's name. |
||
59 | * |
||
60 | * @return string |
||
61 | */ |
||
62 | 42 | public function osName(): string |
|
66 | |||
67 | /** |
||
68 | * Get the OS's short name. |
||
69 | * |
||
70 | * @return string |
||
71 | */ |
||
72 | 42 | public function osShortName(): string |
|
76 | |||
77 | /** |
||
78 | * Get the OS's version. |
||
79 | * |
||
80 | * @return string |
||
81 | */ |
||
82 | 36 | public function osVersion(): string |
|
86 | |||
87 | /** |
||
88 | * Get the browser name. |
||
89 | * |
||
90 | * @return string |
||
91 | */ |
||
92 | 72 | public function browserName() |
|
96 | |||
97 | /** |
||
98 | * Get the browser name. |
||
99 | * |
||
100 | * @return string |
||
101 | */ |
||
102 | 72 | public function browserShortName() |
|
106 | |||
107 | /** |
||
108 | * Get the browser's version. |
||
109 | * |
||
110 | * @return string |
||
111 | */ |
||
112 | 66 | public function browserVersion(): string |
|
116 | |||
117 | /** |
||
118 | * Get the bot's name. |
||
119 | * |
||
120 | * @return string |
||
121 | */ |
||
122 | 30 | public function botName(): string |
|
126 | |||
127 | /** |
||
128 | * Check if it's a visitor. |
||
129 | * |
||
130 | * @return bool |
||
131 | */ |
||
132 | 30 | public function isVisitor(): bool |
|
136 | |||
137 | /* ----------------------------------------------------------------- |
||
138 | | Check Methods |
||
139 | | ----------------------------------------------------------------- |
||
140 | */ |
||
141 | |||
142 | /** |
||
143 | * Check the given name matches browser's name. |
||
144 | * |
||
145 | * @param string $name |
||
146 | * |
||
147 | * @return bool |
||
148 | */ |
||
149 | 72 | public function isBrowserName($name): bool |
|
156 | |||
157 | /** |
||
158 | * Check the given name matches Operating system's name. |
||
159 | * |
||
160 | * @param string $name |
||
161 | * |
||
162 | * @return bool |
||
163 | */ |
||
164 | 42 | public function isOsName($name): bool |
|
171 | |||
172 | /* ----------------------------------------------------------------- |
||
173 | | Other Methods |
||
174 | | ----------------------------------------------------------------- |
||
175 | */ |
||
176 | |||
177 | /** |
||
178 | * @param string $name |
||
179 | * @param array $params |
||
180 | * |
||
181 | * @return mixed |
||
182 | */ |
||
183 | 354 | public function __call($name, $params) |
|
187 | } |
||
188 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.