Completed
Push — add/jetpack-mobile-package ( d1f5cd )
by
unknown
07:53
created

Jetpack_User_Agent_Info::get_platform()   C

Complexity

Conditions 17
Paths 17

Size

Total Lines 43

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 17
nc 17
nop 0
dl 0
loc 43
rs 5.2166
c 0
b 0
f 0

How to fix   Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
use Automattic\Jetpack\Mobile;
4
5
/**
6
 * Determine if the current User Agent matches the passed $kind
7
 *
8
 * @param string $kind Category of mobile device to check for.
9
 *                         Either: any, dumb, smart.
10
 * @param bool   $return_matched_agent Boolean indicating if the UA should be returned
11
 *
12
 * @return bool|string Boolean indicating if current UA matches $kind. If
13
 *                              $return_matched_agent is true, returns the UA string
14
 */
15
function jetpack_is_mobile( $kind = 'any', $return_matched_agent = false ) {
16
	return Mobile::is_mobile( $kind, $return_matched_agent );
17
}
18