| Conditions | 3 |
| Paths | 3 |
| Total Lines | 16 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | public static function parse( $input, $is_option ) { |
||
| 17 | if ( empty( $input ) ) { |
||
| 18 | return null; |
||
| 19 | } |
||
| 20 | |||
| 21 | $expected = array( 'lat', 'lng', 'address', 'zoom' ); |
||
| 22 | $keys = array_keys( $input ); |
||
| 23 | $diff = array_diff( $expected, $keys ); |
||
| 24 | $name = self::$carbon_field->get_name(); |
||
|
|
|||
| 25 | |||
| 26 | if ( ! empty( $diff ) ) { |
||
| 27 | self::throw_exception( __( 'Please make sure that the update array has the proper structure ( <strong>lat</strong>, <strong>lng</strong>, <strong>address</strong>, <strong>zoom</strong>)', 'crb' ) ); |
||
| 28 | } |
||
| 29 | |||
| 30 | return $input; |
||
| 31 | } |
||
| 32 | } |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.