| Conditions | 4 |
| Paths | 4 |
| Total Lines | 12 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| 1 | <?php |
||
| 8 | public static function register( $field ) { |
||
| 9 | if ( ! is_subclass_of( $field, 'GravityView_Field' ) ) { |
||
| 10 | throw new Exception( 'Must be a subclass of GravityView_Field' ); |
||
| 11 | } |
||
| 12 | if ( empty( $field->type ) ) { |
||
| 13 | throw new Exception( 'The type must be set' ); |
||
| 14 | } |
||
| 15 | if ( isset( self::$_fields[ $field->type ] ) ) { |
||
| 16 | throw new Exception( 'Field type already registered: ' . $field->type ); |
||
| 17 | } |
||
| 18 | self::$_fields[ $field->type ] = $field; |
||
| 19 | } |
||
| 20 | |||
| 40 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.