| Conditions | 4 |
| Paths | 6 |
| Total Lines | 18 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | public function set_value_from_input( $input ) { |
||
| 15 | $options_values = $this->get_options_values(); |
||
| 16 | |||
| 17 | $value = null; |
||
| 18 | if ( isset( $input[ $this->get_name() ] ) ) { |
||
| 19 | $raw_value = stripslashes_deep( $input[ $this->get_name() ] ); |
||
| 20 | $raw_value = Helper::get_valid_options( array( $raw_value ), $options_values ); |
||
| 21 | if ( ! empty( $raw_value ) ) { |
||
| 22 | $value = $raw_value[0]; |
||
| 23 | } |
||
| 24 | } |
||
| 25 | |||
| 26 | if ( $value === null ) { |
||
| 27 | $value = $options_values[0]; |
||
| 28 | } |
||
| 29 | |||
| 30 | return $this->set_value( $value ); |
||
| 31 | } |
||
| 32 | |||
| 66 |