Code Duplication    Length = 11-12 lines in 9 locations

src/OsDetector.php 9 locations

@@ 265-275 (lines=11) @@
262
     *
263
     * @return bool
264
     */
265
    private static function checkLinux(Os $os, UserAgent $userAgent)
266
    {
267
        if (stripos($userAgent->getUserAgentString(), 'Linux') !== false) {
268
            $os->setVersion($os::VERSION_UNKNOWN);
269
            $os->setName($os::LINUX);
270
271
            return true;
272
        }
273
274
        return false;
275
    }
276
277
    /**
278
     * Determine if the user's operating system is Nokia.
@@ 285-296 (lines=12) @@
282
     *
283
     * @return bool
284
     */
285
    private static function checkNokia(Os $os, UserAgent $userAgent)
286
    {
287
        if (stripos($userAgent->getUserAgentString(), 'Nokia') !== false) {
288
            $os->setVersion($os::VERSION_UNKNOWN);
289
            $os->setName($os::NOKIA);
290
            $os->setIsMobile(true);
291
292
            return true;
293
        }
294
295
        return false;
296
    }
297
298
    /**
299
     * Determine if the user's operating system is BlackBerry.
@@ 366-376 (lines=11) @@
363
     *
364
     * @return bool
365
     */
366
    private static function checkFreeBSD(Os $os, UserAgent $userAgent)
367
    {
368
        if (stripos($userAgent->getUserAgentString(), 'FreeBSD') !== false) {
369
            $os->setVersion($os::VERSION_UNKNOWN);
370
            $os->setName($os::FREEBSD);
371
372
            return true;
373
        }
374
375
        return false;
376
    }
377
378
    /**
379
     * Determine if the user's operating system is OpenBSD.
@@ 386-396 (lines=11) @@
383
     *
384
     * @return bool
385
     */
386
    private static function checkOpenBSD(Os $os, UserAgent $userAgent)
387
    {
388
        if (stripos($userAgent->getUserAgentString(), 'OpenBSD') !== false) {
389
            $os->setVersion($os::VERSION_UNKNOWN);
390
            $os->setName($os::OPENBSD);
391
392
            return true;
393
        }
394
395
        return false;
396
    }
397
398
    /**
399
     * Determine if the user's operating system is SunOS.
@@ 406-416 (lines=11) @@
403
     *
404
     * @return bool
405
     */
406
    private static function checkSunOS(Os $os, UserAgent $userAgent)
407
    {
408
        if (stripos($userAgent->getUserAgentString(), 'SunOS') !== false) {
409
            $os->setVersion($os::VERSION_UNKNOWN);
410
            $os->setName($os::SUNOS);
411
412
            return true;
413
        }
414
415
        return false;
416
    }
417
418
    /**
419
     * Determine if the user's operating system is NetBSD.
@@ 426-436 (lines=11) @@
423
     *
424
     * @return bool
425
     */
426
    private static function checkNetBSD(Os $os, UserAgent $userAgent)
427
    {
428
        if (stripos($userAgent->getUserAgentString(), 'NetBSD') !== false) {
429
            $os->setVersion($os::VERSION_UNKNOWN);
430
            $os->setName($os::NETBSD);
431
432
            return true;
433
        }
434
435
        return false;
436
    }
437
438
    /**
439
     * Determine if the user's operating system is OpenSolaris.
@@ 446-456 (lines=11) @@
443
     *
444
     * @return bool
445
     */
446
    private static function checkOpenSolaris(Os $os, UserAgent $userAgent)
447
    {
448
        if (stripos($userAgent->getUserAgentString(), 'OpenSolaris') !== false) {
449
            $os->setVersion($os::VERSION_UNKNOWN);
450
            $os->setName($os::OPENSOLARIS);
451
452
            return true;
453
        }
454
455
        return false;
456
    }
457
458
    /**
459
     * Determine if the user's operating system is OS2.
@@ 466-476 (lines=11) @@
463
     *
464
     * @return bool
465
     */
466
    private static function checkOS2(Os $os, UserAgent $userAgent)
467
    {
468
        if (stripos($userAgent->getUserAgentString(), 'OS\/2') !== false) {
469
            $os->setVersion($os::VERSION_UNKNOWN);
470
            $os->setName($os::OS2);
471
472
            return true;
473
        }
474
475
        return false;
476
    }
477
478
    /**
479
     * Determine if the user's operating system is BeOS.
@@ 486-496 (lines=11) @@
483
     *
484
     * @return bool
485
     */
486
    private static function checkBeOS(Os $os, UserAgent $userAgent)
487
    {
488
        if (stripos($userAgent->getUserAgentString(), 'BeOS') !== false) {
489
            $os->setVersion($os::VERSION_UNKNOWN);
490
            $os->setName($os::BEOS);
491
492
            return true;
493
        }
494
495
        return false;
496
    }
497
}
498