Code Duplication    Length = 12-16 lines in 4 locations

packages/device-detection/src/class-device-detection.php 4 locations

@@ 1164-1179 (lines=16) @@
1161
	/*
1162
	 is_webkit() can be used to check the User Agent for an webkit generic browser
1163
	 */
1164
	static function is_webkit() {
1165
1166
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
1167
			return false;
1168
		}
1169
1170
		$agent = strtolower( $_SERVER['HTTP_USER_AGENT'] );
1171
1172
		$pos_webkit = strpos( $agent, 'webkit' );
1173
1174
		if ( $pos_webkit !== false ) {
1175
			return true;
1176
		} else {
1177
			return false;
1178
		}
1179
	}
1180
1181
	/**
1182
	 * Detects if the current browser is the Native Android browser.
@@ 1264-1275 (lines=12) @@
1261
	 *
1262
	 * @return boolean true if the browser is Kindle monochrome Native browser otherwise false
1263
	 */
1264
	static function is_kindle_touch() {
1265
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
1266
			return false;
1267
		}
1268
		$agent            = strtolower( $_SERVER['HTTP_USER_AGENT'] );
1269
		$pos_kindle_touch = strpos( $agent, 'kindle/3.0+' );
1270
		if ( false !== $pos_kindle_touch && false === self::is_kindle_fire() ) {
1271
			return true;
1272
		} else {
1273
			return false;
1274
		}
1275
	}
1276
1277
1278
	// Detect if user agent is the WordPress.com Windows 8 app (used ONLY on the custom oauth stylesheet)
@@ 1279-1291 (lines=13) @@
1276
1277
1278
	// Detect if user agent is the WordPress.com Windows 8 app (used ONLY on the custom oauth stylesheet)
1279
	static function is_windows8_auth() {
1280
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
1281
			return false;
1282
		}
1283
1284
		$agent = strtolower( $_SERVER['HTTP_USER_AGENT'] );
1285
		$pos   = strpos( $agent, 'msauthhost' );
1286
		if ( false !== $pos ) {
1287
			return true;
1288
		} else {
1289
			return false;
1290
		}
1291
	}
1292
1293
	// Detect if user agent is the WordPress.com Windows 8 app.
1294
	static function is_wordpress_for_win8() {
@@ 1294-1306 (lines=13) @@
1291
	}
1292
1293
	// Detect if user agent is the WordPress.com Windows 8 app.
1294
	static function is_wordpress_for_win8() {
1295
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
1296
			return false;
1297
		}
1298
1299
		$agent = strtolower( $_SERVER['HTTP_USER_AGENT'] );
1300
		$pos   = strpos( $agent, 'wp-windows8' );
1301
		if ( false !== $pos ) {
1302
			return true;
1303
		} else {
1304
			return false;
1305
		}
1306
	}
1307
1308
1309
	// Detect if user agent is the WordPress.com Desktop app.