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
@@ 829-840 (lines=12) @@
826
	 * Detects if the current browser is a Windows Phone 8 device.
827
	 * ex: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; ARM; Touch; IEMobile/10.0; <Manufacturer>; <Device> [;<Operator>])
828
	 */
829
	public static function is_windows_phone_8() {
830
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
831
			return false;
832
		}
833
834
		$ua = strtolower( $_SERVER['HTTP_USER_AGENT'] );
835
		if ( strpos( $ua, 'windows phone 8' ) === false ) {
836
			return false;
837
		} else {
838
			return true;
839
		}
840
	}
841
842
	/**
843
	 * Detects if the current browser is on a Palm device running the new WebOS. This EXCLUDES TouchPad.
@@ 1462-1472 (lines=11) @@
1459
	 * Example: Mozilla/5.0 (Nintendo 3DS; U; ; en) Version/1.7498.US
1460
	 * can differ in language, version and region
1461
	 */
1462
	public static function is_Nintendo_3DS() {
1463
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
1464
			return false;
1465
		}
1466
1467
		$ua = strtolower( $_SERVER['HTTP_USER_AGENT'] );
1468
		if ( strpos( $ua, 'nintendo 3ds' ) !== false ) {
1469
			return true;
1470
		}
1471
		return false;
1472
	}
1473
1474
	/**
1475
	 * Was the current request made by a known bot?