Code Duplication    Length = 12-16 lines in 5 locations

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

@@ 1054-1069 (lines=16) @@
1051
	/**
1052
	 * The is_webkit() method can be used to check the User Agent for an webkit generic browser.
1053
	 */
1054
	public static function is_webkit() {
1055
1056
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
1057
			return false;
1058
		}
1059
1060
		$agent = strtolower( $_SERVER['HTTP_USER_AGENT'] );
1061
1062
		$pos_webkit = strpos( $agent, 'webkit' );
1063
1064
		if ( false !== $pos_webkit ) {
1065
			return true;
1066
		} else {
1067
			return false;
1068
		}
1069
	}
1070
1071
	/**
1072
	 * Detects if the current browser is the Native Android browser.
@@ 1152-1163 (lines=12) @@
1149
	 *
1150
	 * @return boolean true if the browser is Kindle monochrome Native browser otherwise false
1151
	 */
1152
	public static function is_kindle_touch() {
1153
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
1154
			return false;
1155
		}
1156
		$agent            = strtolower( $_SERVER['HTTP_USER_AGENT'] );
1157
		$pos_kindle_touch = strpos( $agent, 'kindle/3.0+' );
1158
		if ( false !== $pos_kindle_touch && false === self::is_kindle_fire() ) {
1159
			return true;
1160
		} else {
1161
			return false;
1162
		}
1163
	}
1164
1165
	/**
1166
	 * Detect if user agent is the WordPress.com Windows 8 app (used ONLY on the custom oauth stylesheet)
@@ 1168-1180 (lines=13) @@
1165
	/**
1166
	 * Detect if user agent is the WordPress.com Windows 8 app (used ONLY on the custom oauth stylesheet)
1167
	 */
1168
	public static function is_windows8_auth() {
1169
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
1170
			return false;
1171
		}
1172
1173
		$agent = strtolower( $_SERVER['HTTP_USER_AGENT'] );
1174
		$pos   = strpos( $agent, 'msauthhost' );
1175
		if ( false !== $pos ) {
1176
			return true;
1177
		} else {
1178
			return false;
1179
		}
1180
	}
1181
1182
	/**
1183
	 * Detect if user agent is the WordPress.com Windows 8 app.
@@ 1185-1197 (lines=13) @@
1182
	/**
1183
	 * Detect if user agent is the WordPress.com Windows 8 app.
1184
	 */
1185
	public static function is_wordpress_for_win8() {
1186
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
1187
			return false;
1188
		}
1189
1190
		$agent = strtolower( $_SERVER['HTTP_USER_AGENT'] );
1191
		$pos   = strpos( $agent, 'wp-windows8' );
1192
		if ( false !== $pos ) {
1193
			return true;
1194
		} else {
1195
			return false;
1196
		}
1197
	}
1198
1199
	/**
1200
	 * Detect if user agent is the WordPress.com Desktop app.
@@ 1202-1214 (lines=13) @@
1199
	/**
1200
	 * Detect if user agent is the WordPress.com Desktop app.
1201
	 */
1202
	public static function is_wordpress_desktop_app() {
1203
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
1204
			return false;
1205
		}
1206
1207
		$agent = strtolower( $_SERVER['HTTP_USER_AGENT'] );
1208
		$pos   = strpos( $agent, 'WordPressDesktop' );
1209
		if ( false !== $pos ) {
1210
			return true;
1211
		} else {
1212
			return false;
1213
		}
1214
	}
1215
1216
	/**
1217
	 * The is_blackberry_tablet() method can be used to check the User Agent for a RIM blackberry tablet.