Code Duplication    Length = 12-16 lines in 5 locations

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

@@ 1071-1086 (lines=16) @@
1068
	/**
1069
	 * The is_webkit() method can be used to check the User Agent for an webkit generic browser.
1070
	 */
1071
	public static function is_webkit() {
1072
1073
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
1074
			return false;
1075
		}
1076
1077
		$agent = strtolower( $_SERVER['HTTP_USER_AGENT'] );
1078
1079
		$pos_webkit = strpos( $agent, 'webkit' );
1080
1081
		if ( false !== $pos_webkit ) {
1082
			return true;
1083
		} else {
1084
			return false;
1085
		}
1086
	}
1087
1088
	/**
1089
	 * Detects if the current browser is the Native Android browser.
@@ 1170-1181 (lines=12) @@
1167
	 *
1168
	 * @return boolean true if the browser is Kindle monochrome Native browser otherwise false
1169
	 */
1170
	public static function is_kindle_touch() {
1171
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
1172
			return false;
1173
		}
1174
		$agent            = strtolower( $_SERVER['HTTP_USER_AGENT'] );
1175
		$pos_kindle_touch = strpos( $agent, 'kindle/3.0+' );
1176
		if ( false !== $pos_kindle_touch && false === self::is_kindle_fire() ) {
1177
			return true;
1178
		} else {
1179
			return false;
1180
		}
1181
	}
1182
1183
1184
	/**
@@ 1187-1199 (lines=13) @@
1184
	/**
1185
	 * Detect if user agent is the WordPress.com Windows 8 app (used ONLY on the custom oauth stylesheet)
1186
	 */
1187
	public static function is_windows8_auth() {
1188
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
1189
			return false;
1190
		}
1191
1192
		$agent = strtolower( $_SERVER['HTTP_USER_AGENT'] );
1193
		$pos   = strpos( $agent, 'msauthhost' );
1194
		if ( false !== $pos ) {
1195
			return true;
1196
		} else {
1197
			return false;
1198
		}
1199
	}
1200
1201
	/**
1202
	 * Detect if user agent is the WordPress.com Windows 8 app.
@@ 1204-1216 (lines=13) @@
1201
	/**
1202
	 * Detect if user agent is the WordPress.com Windows 8 app.
1203
	 */
1204
	public static function is_wordpress_for_win8() {
1205
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
1206
			return false;
1207
		}
1208
1209
		$agent = strtolower( $_SERVER['HTTP_USER_AGENT'] );
1210
		$pos   = strpos( $agent, 'wp-windows8' );
1211
		if ( false !== $pos ) {
1212
			return true;
1213
		} else {
1214
			return false;
1215
		}
1216
	}
1217
1218
	/**
1219
	 * Detect if user agent is the WordPress.com Desktop app.
@@ 1221-1233 (lines=13) @@
1218
	/**
1219
	 * Detect if user agent is the WordPress.com Desktop app.
1220
	 */
1221
	public static function is_wordpress_desktop_app() {
1222
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
1223
			return false;
1224
		}
1225
1226
		$agent = strtolower( $_SERVER['HTTP_USER_AGENT'] );
1227
		$pos   = strpos( $agent, 'WordPressDesktop' );
1228
		if ( false !== $pos ) {
1229
			return true;
1230
		} else {
1231
			return false;
1232
		}
1233
	}
1234
1235
	/**
1236
	 * The is_blackberry_tablet() method can be used to check the User Agent for a RIM blackberry tablet.