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.
@@ 369-379 (lines=11) @@
366
     *
367
     * @return bool
368
     */
369
    private static function checkFreeBSD(Os $os, UserAgent $userAgent)
370
    {
371
        if (stripos($userAgent->getUserAgentString(), 'FreeBSD') !== false) {
372
            $os->setVersion($os::VERSION_UNKNOWN);
373
            $os->setName($os::FREEBSD);
374
375
            return true;
376
        }
377
378
        return false;
379
    }
380
381
    /**
382
     * Determine if the user's operating system is OpenBSD.
@@ 389-399 (lines=11) @@
386
     *
387
     * @return bool
388
     */
389
    private static function checkOpenBSD(Os $os, UserAgent $userAgent)
390
    {
391
        if (stripos($userAgent->getUserAgentString(), 'OpenBSD') !== false) {
392
            $os->setVersion($os::VERSION_UNKNOWN);
393
            $os->setName($os::OPENBSD);
394
395
            return true;
396
        }
397
398
        return false;
399
    }
400
401
    /**
402
     * Determine if the user's operating system is SunOS.
@@ 409-419 (lines=11) @@
406
     *
407
     * @return bool
408
     */
409
    private static function checkSunOS(Os $os, UserAgent $userAgent)
410
    {
411
        if (stripos($userAgent->getUserAgentString(), 'SunOS') !== false) {
412
            $os->setVersion($os::VERSION_UNKNOWN);
413
            $os->setName($os::SUNOS);
414
415
            return true;
416
        }
417
418
        return false;
419
    }
420
421
    /**
422
     * Determine if the user's operating system is NetBSD.
@@ 429-439 (lines=11) @@
426
     *
427
     * @return bool
428
     */
429
    private static function checkNetBSD(Os $os, UserAgent $userAgent)
430
    {
431
        if (stripos($userAgent->getUserAgentString(), 'NetBSD') !== false) {
432
            $os->setVersion($os::VERSION_UNKNOWN);
433
            $os->setName($os::NETBSD);
434
435
            return true;
436
        }
437
438
        return false;
439
    }
440
441
    /**
442
     * Determine if the user's operating system is OpenSolaris.
@@ 449-459 (lines=11) @@
446
     *
447
     * @return bool
448
     */
449
    private static function checkOpenSolaris(Os $os, UserAgent $userAgent)
450
    {
451
        if (stripos($userAgent->getUserAgentString(), 'OpenSolaris') !== false) {
452
            $os->setVersion($os::VERSION_UNKNOWN);
453
            $os->setName($os::OPENSOLARIS);
454
455
            return true;
456
        }
457
458
        return false;
459
    }
460
461
    /**
462
     * Determine if the user's operating system is OS2.
@@ 469-479 (lines=11) @@
466
     *
467
     * @return bool
468
     */
469
    private static function checkOS2(Os $os, UserAgent $userAgent)
470
    {
471
        if (stripos($userAgent->getUserAgentString(), 'OS\/2') !== false) {
472
            $os->setVersion($os::VERSION_UNKNOWN);
473
            $os->setName($os::OS2);
474
475
            return true;
476
        }
477
478
        return false;
479
    }
480
481
    /**
482
     * Determine if the user's operating system is BeOS.
@@ 489-499 (lines=11) @@
486
     *
487
     * @return bool
488
     */
489
    private static function checkBeOS(Os $os, UserAgent $userAgent)
490
    {
491
        if (stripos($userAgent->getUserAgentString(), 'BeOS') !== false) {
492
            $os->setVersion($os::VERSION_UNKNOWN);
493
            $os->setName($os::BEOS);
494
495
            return true;
496
        }
497
498
        return false;
499
    }
500
}
501