Code Duplication    Length = 12-16 lines in 4 locations

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

@@ 1224-1239 (lines=16) @@
1221
	/*
1222
	 is_webkit() can be used to check the User Agent for an webkit generic browser
1223
	 */
1224
	static function is_webkit() {
1225
1226
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
1227
			return false;
1228
		}
1229
1230
		$agent = strtolower( $_SERVER['HTTP_USER_AGENT'] );
1231
1232
		$pos_webkit = strpos( $agent, 'webkit' );
1233
1234
		if ( $pos_webkit !== false ) {
1235
			return true;
1236
		} else {
1237
			return false;
1238
		}
1239
	}
1240
1241
	/**
1242
	 * Detects if the current browser is the Native Android browser.
@@ 1324-1335 (lines=12) @@
1321
	 *
1322
	 * @return boolean true if the browser is Kindle monochrome Native browser otherwise false
1323
	 */
1324
	static function is_kindle_touch() {
1325
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
1326
			return false;
1327
		}
1328
		$agent            = strtolower( $_SERVER['HTTP_USER_AGENT'] );
1329
		$pos_kindle_touch = strpos( $agent, 'kindle/3.0+' );
1330
		if ( false !== $pos_kindle_touch && false === self::is_kindle_fire() ) {
1331
			return true;
1332
		} else {
1333
			return false;
1334
		}
1335
	}
1336
1337
1338
	// Detect if user agent is the WordPress.com Windows 8 app (used ONLY on the custom oauth stylesheet)
@@ 1339-1351 (lines=13) @@
1336
1337
1338
	// Detect if user agent is the WordPress.com Windows 8 app (used ONLY on the custom oauth stylesheet)
1339
	static function is_windows8_auth() {
1340
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
1341
			return false;
1342
		}
1343
1344
		$agent = strtolower( $_SERVER['HTTP_USER_AGENT'] );
1345
		$pos   = strpos( $agent, 'msauthhost' );
1346
		if ( false !== $pos ) {
1347
			return true;
1348
		} else {
1349
			return false;
1350
		}
1351
	}
1352
1353
	// Detect if user agent is the WordPress.com Windows 8 app.
1354
	static function is_wordpress_for_win8() {
@@ 1354-1366 (lines=13) @@
1351
	}
1352
1353
	// Detect if user agent is the WordPress.com Windows 8 app.
1354
	static function is_wordpress_for_win8() {
1355
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
1356
			return false;
1357
		}
1358
1359
		$agent = strtolower( $_SERVER['HTTP_USER_AGENT'] );
1360
		$pos   = strpos( $agent, 'wp-windows8' );
1361
		if ( false !== $pos ) {
1362
			return true;
1363
		} else {
1364
			return false;
1365
		}
1366
	}
1367
1368
1369
	// Detect if user agent is the WordPress.com Desktop app.