Code Duplication    Length = 11-12 lines in 3 locations

projects/packages/device-detection/src/class-user-agent-info.php 3 locations

@@ 716-726 (lines=11) @@
713
	 *
714
	 * Looking for "OPR/" specifically.
715
	 */
716
	public static function is_opera_desktop() {
717
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
718
			return false;
719
		}
720
721
		if ( false === strpos( $_SERVER['HTTP_USER_AGENT'], 'OPR/' ) ) {
722
			return false;
723
		}
724
725
		return true;
726
	}
727
728
	/**
729
	 * Detects if the current browser is Opera Mobile
@@ 856-867 (lines=12) @@
853
	 * Detects if the current browser is a Windows Phone 8 device.
854
	 * ex: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; ARM; Touch; IEMobile/10.0; <Manufacturer>; <Device> [;<Operator>])
855
	 */
856
	public static function is_windows_phone_8() {
857
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
858
			return false;
859
		}
860
861
		$ua = strtolower( $_SERVER['HTTP_USER_AGENT'] );
862
		if ( strpos( $ua, 'windows phone 8' ) === false ) {
863
			return false;
864
		} else {
865
			return true;
866
		}
867
	}
868
869
	/**
870
	 * Detects if the current browser is on a Palm device running the new WebOS. This EXCLUDES TouchPad.
@@ 1489-1499 (lines=11) @@
1486
	 * Example: Mozilla/5.0 (Nintendo 3DS; U; ; en) Version/1.7498.US
1487
	 * can differ in language, version and region
1488
	 */
1489
	public static function is_Nintendo_3DS() {
1490
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
1491
			return false;
1492
		}
1493
1494
		$ua = strtolower( $_SERVER['HTTP_USER_AGENT'] );
1495
		if ( strpos( $ua, 'nintendo 3ds' ) !== false ) {
1496
			return true;
1497
		}
1498
		return false;
1499
	}
1500
1501
	/**
1502
	 * Was the current request made by a known bot?