196
196
* @method bool isNetFront()
197
197
* @method bool isGenericBrowser()
198
198
* @method bool isPaleMoon()
199
- * @method bool isBot()
200
- * @method bool isMobileBot()
201
- * @method bool isDesktopMode()
202
- * @method bool isTV()
203
199
* @method bool isWebKit()
204
200
* @method bool isConsole()
205
201
* @method bool isWatch()
@@ -211,97 +207,61 @@ interface MobileDetectorInterface
211
207
*
212
208
* @method bool is[...]()
213
209
*
214
- * @param string $name
215
- * @param array $arguments
216
- *
217
210
* @throws \BadMethodCallException when the method doesn't exist and doesn't start with 'is'
218
211
*/
219
- public function __call ($ name , $ arguments );
212
+ public function __call (string $ name , array $ arguments );
220
213
221
214
/**
222
215
* Retrieve the list of known browsers. Specifically, the user agents.
223
216
*
224
217
* @return array list of browsers / user agents
225
218
*/
226
- public static function getBrowsers ();
219
+ public static function getBrowsers (): array ;
227
220
228
221
/**
229
222
* Retrieve the list of mobile operating systems.
230
223
*
231
224
* @return array the list of mobile operating systems
232
225
*/
233
- public static function getOperatingSystems ();
226
+ public static function getOperatingSystems (): array ;
234
227
235
228
/**
236
229
* Retrieve the list of known phone devices.
237
230
*
238
231
* @return array list of phone devices
239
232
*/
240
- public static function getPhoneDevices ();
233
+ public static function getPhoneDevices (): array ;
241
234
242
235
/**
243
236
* Get the properties array.
244
- *
245
- * @return array
246
237
*/
247
- public static function getProperties ();
248
-
249
- /**
250
- * Get the current script version.
251
- * This is useful for the demo.php file,
252
- * so people can check on what version they are testing
253
- * for mobile devices.
254
- *
255
- * @return string the version number in semantic version format
256
- */
257
- public static function getScriptVersion ();
238
+ public static function getProperties (): array ;
258
239
259
240
/**
260
241
* Retrieve the list of known tablet devices.
261
242
*
262
243
* @return array list of tablet devices
263
244
*/
264
- public static function getTabletDevices ();
245
+ public static function getTabletDevices (): array ;
265
246
266
247
/**
267
248
* Alias for getBrowsers() method.
268
249
*
269
250
* @return array list of user agents
270
251
*/
271
- public static function getUserAgents ();
272
-
273
- /**
274
- * Retrieve the list of known utilities.
275
- *
276
- * @return array list of utilities
277
- */
278
- public static function getUtilities ();
252
+ public static function getUserAgents (): array ;
279
253
280
254
/**
281
255
* Check the HTTP headers for signs of mobile.
282
256
* This is the fastest mobile check possible; it's used
283
257
* inside isMobile() method.
284
- *
285
- * @return bool
286
258
*/
287
- public function checkHttpHeadersForMobile ();
259
+ public function checkHttpHeadersForMobile (): bool ;
288
260
289
261
/**
290
262
* Retrieves the cloudfront headers.
291
- *
292
- * @return array
293
263
*/
294
- public function getCfHeaders ();
295
-
296
- /**
297
- * Set CloudFront headers
298
- * http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/header-caching.html#header-caching-web-device.
299
- *
300
- * @param array $cfHeaders List of HTTP headers
301
- *
302
- * @return bool If there were CloudFront headers to be set
303
- */
304
- public function setCfHeaders ($ cfHeaders = null );
264
+ public function getCfHeaders (): array ;
305
265
306
266
/**
307
267
* Retrieves a particular header. If it doesn't exist, no exception/error is caused.
@@ -313,78 +273,67 @@ public function setCfHeaders($cfHeaders = null);
313
273
*
314
274
* @return string|null the value of the header
315
275
*/
316
- public function getHttpHeader ($ header );
276
+ public function getHttpHeader (string $ header ): ? string ;
317
277
318
278
/**
319
279
* Retrieves the HTTP headers.
320
- *
321
- * @return array
322
280
*/
323
- public function getHttpHeaders ();
281
+ public function getHttpHeaders (): array ;
324
282
325
283
/**
326
284
* Set the HTTP Headers. Must be PHP-flavored. This method will reset existing headers.
327
285
*
328
- * @param array $httpHeaders The headers to set. If null, then using PHP's _SERVER to extract
329
- * the headers. The default null is left for backwards compatibility.
286
+ * @param array $httpHeaders the headers to set
330
287
*/
331
- public function setHttpHeaders ($ httpHeaders = null ) ;
288
+ public function setHttpHeaders (array $ httpHeaders = []): void ;
332
289
333
- public function getMatchesArray ();
290
+ public function getMatchesArray (): ? array ;
334
291
335
- public function getMatchingRegex ();
292
+ public function getMatchingRegex (): ? string ;
336
293
337
- public function getMobileHeaders ();
294
+ public function getMobileHeaders (): array ;
338
295
339
296
/**
340
297
* Get all possible HTTP headers that
341
298
* can contain the User-Agent string.
342
299
*
343
300
* @return array list of HTTP headers
344
301
*/
345
- public function getUaHttpHeaders ();
302
+ public function getUaHttpHeaders (): array ;
346
303
347
304
/**
348
305
* Retrieve the User-Agent.
349
306
*
350
307
* @return string|null the user agent if it's set
351
308
*/
352
- public function getUserAgent ();
309
+ public function getUserAgent (): ? string ;
353
310
354
311
/**
355
312
* Set the User-Agent to be used.
356
313
*
357
314
* @param string $userAgent the user agent string to set
358
- *
359
- * @return string|null
360
315
*/
361
- public function setUserAgent ($ userAgent = null ) ;
316
+ public function setUserAgent (string $ userAgent): string ;
362
317
363
318
/**
364
319
* This method checks for a certain property in the
365
320
* userAgent.
366
321
*
367
- * @param string $key
368
- *
369
322
* @return bool|int|null
370
323
*/
371
- public function is ($ key );
324
+ public function is (string $ key );
372
325
373
326
/**
374
327
* Check if the device is mobile.
375
328
* Returns true if any type of mobile device detected, including special ones.
376
- *
377
- * @return bool
378
329
*/
379
- public function isMobile ();
330
+ public function isMobile (): bool ;
380
331
381
332
/**
382
333
* Check if the device is a tablet.
383
334
* Return true if any type of tablet device is detected.
384
- *
385
- * @return bool
386
335
*/
387
- public function isTablet ();
336
+ public function isTablet (): bool ;
388
337
389
338
/**
390
339
* Some detection rules are relative (not standard),
@@ -394,21 +343,15 @@ public function isTablet();
394
343
*
395
344
* This method will be used to check custom regexes against
396
345
* the User-Agent string.
397
- *
398
- * @param string $userAgent
399
- *
400
- * @return bool
401
346
*/
402
- public function match ($ regex , $ userAgent = null ) ;
347
+ public function match (string $ regex , string $ userAgent): bool ;
403
348
404
349
/**
405
350
* Prepare the version number.
406
351
*
407
352
* @param string $ver The string version, like "2.6.21.2152";
408
- *
409
- * @return float
410
353
*/
411
- public function prepareVersionNo ($ ver );
354
+ public function prepareVersionNo (string $ ver ): float ;
412
355
413
356
/**
414
357
* Check the version of the given property in the User-Agent.
@@ -423,5 +366,5 @@ public function prepareVersionNo($ver);
423
366
*
424
367
* @return string|float the version of the property we are trying to extract
425
368
*/
426
- public function version ($ propertyName , $ type = MobileDetector::VERSION_TYPE_STRING );
369
+ public function version (string $ propertyName , string $ type = MobileDetector::VERSION_TYPE_STRING ): float | bool | string ;
427
370
}
0 commit comments