Code Duplication    Length = 11-12 lines in 9 locations

src/OsDetector.php 9 locations

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