| Conditions | 7 |
| Paths | 3 |
| Total Lines | 23 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 39 | function save() { |
||
| 40 | $name = $this->get_name(); |
||
| 41 | $value = $this->get_value(); |
||
| 42 | |||
| 43 | // Set the value for the field |
||
| 44 | $this->set_name($name); |
||
| 45 | |||
| 46 | $field_value = ''; |
||
| 47 | if ( isset($value) && $value !== '' && is_numeric($value) ) { |
||
| 48 | $value = floatval($value); |
||
| 49 | |||
| 50 | $is_valid_min = $this->min <= $value; |
||
| 51 | $is_valid_max = $value <= $this->max; |
||
| 52 | |||
| 53 | if ( $value !== '' && $is_valid_min && $is_valid_max ) { |
||
| 54 | $field_value = $value; |
||
| 55 | } |
||
| 56 | } |
||
| 57 | |||
| 58 | $this->set_value($field_value); |
||
| 59 | |||
| 60 | parent::save(); |
||
| 61 | } |
||
| 62 | |||
| 77 | } |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.