Code Duplication    Length = 11-12 lines in 9 locations

src/OsDetector.php 9 locations

@@ 268-278 (lines=11) @@
265
     *
266
     * @return bool
267
     */
268
    private static function checkLinux(Os $os, UserAgent $userAgent)
269
    {
270
        if (stripos($userAgent->getUserAgentString(), 'Linux') !== false) {
271
            $os->setVersion($os::VERSION_UNKNOWN);
272
            $os->setName($os::LINUX);
273
274
            return true;
275
        }
276
277
        return false;
278
    }
279
280
    /**
281
     * Determine if the user's operating system is Nokia.
@@ 288-299 (lines=12) @@
285
     *
286
     * @return bool
287
     */
288
    private static function checkNokia(Os $os, UserAgent $userAgent)
289
    {
290
        if (stripos($userAgent->getUserAgentString(), 'Nokia') !== false) {
291
            $os->setVersion($os::VERSION_UNKNOWN);
292
            $os->setName($os::NOKIA);
293
            $os->setIsMobile(true);
294
295
            return true;
296
        }
297
298
        return false;
299
    }
300
301
    /**
302
     * Determine if the user's operating system is BlackBerry.
@@ 377-387 (lines=11) @@
374
     *
375
     * @return bool
376
     */
377
    private static function checkFreeBSD(Os $os, UserAgent $userAgent)
378
    {
379
        if (stripos($userAgent->getUserAgentString(), 'FreeBSD') !== false) {
380
            $os->setVersion($os::VERSION_UNKNOWN);
381
            $os->setName($os::FREEBSD);
382
383
            return true;
384
        }
385
386
        return false;
387
    }
388
389
    /**
390
     * Determine if the user's operating system is OpenBSD.
@@ 397-407 (lines=11) @@
394
     *
395
     * @return bool
396
     */
397
    private static function checkOpenBSD(Os $os, UserAgent $userAgent)
398
    {
399
        if (stripos($userAgent->getUserAgentString(), 'OpenBSD') !== false) {
400
            $os->setVersion($os::VERSION_UNKNOWN);
401
            $os->setName($os::OPENBSD);
402
403
            return true;
404
        }
405
406
        return false;
407
    }
408
409
    /**
410
     * Determine if the user's operating system is SunOS.
@@ 417-427 (lines=11) @@
414
     *
415
     * @return bool
416
     */
417
    private static function checkSunOS(Os $os, UserAgent $userAgent)
418
    {
419
        if (stripos($userAgent->getUserAgentString(), 'SunOS') !== false) {
420
            $os->setVersion($os::VERSION_UNKNOWN);
421
            $os->setName($os::SUNOS);
422
423
            return true;
424
        }
425
426
        return false;
427
    }
428
429
    /**
430
     * Determine if the user's operating system is NetBSD.
@@ 437-447 (lines=11) @@
434
     *
435
     * @return bool
436
     */
437
    private static function checkNetBSD(Os $os, UserAgent $userAgent)
438
    {
439
        if (stripos($userAgent->getUserAgentString(), 'NetBSD') !== false) {
440
            $os->setVersion($os::VERSION_UNKNOWN);
441
            $os->setName($os::NETBSD);
442
443
            return true;
444
        }
445
446
        return false;
447
    }
448
449
    /**
450
     * Determine if the user's operating system is OpenSolaris.
@@ 457-467 (lines=11) @@
454
     *
455
     * @return bool
456
     */
457
    private static function checkOpenSolaris(Os $os, UserAgent $userAgent)
458
    {
459
        if (stripos($userAgent->getUserAgentString(), 'OpenSolaris') !== false) {
460
            $os->setVersion($os::VERSION_UNKNOWN);
461
            $os->setName($os::OPENSOLARIS);
462
463
            return true;
464
        }
465
466
        return false;
467
    }
468
469
    /**
470
     * Determine if the user's operating system is OS2.
@@ 477-487 (lines=11) @@
474
     *
475
     * @return bool
476
     */
477
    private static function checkOS2(Os $os, UserAgent $userAgent)
478
    {
479
        if (stripos($userAgent->getUserAgentString(), 'OS\/2') !== false) {
480
            $os->setVersion($os::VERSION_UNKNOWN);
481
            $os->setName($os::OS2);
482
483
            return true;
484
        }
485
486
        return false;
487
    }
488
489
    /**
490
     * Determine if the user's operating system is BeOS.
@@ 497-507 (lines=11) @@
494
     *
495
     * @return bool
496
     */
497
    private static function checkBeOS(Os $os, UserAgent $userAgent)
498
    {
499
        if (stripos($userAgent->getUserAgentString(), 'BeOS') !== false) {
500
            $os->setVersion($os::VERSION_UNKNOWN);
501
            $os->setName($os::BEOS);
502
503
            return true;
504
        }
505
506
        return false;
507
    }
508
}
509