| Conditions | 7 |
| Paths | 8 |
| Total Lines | 19 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 27 | public function parseContextual($value) |
||
| 28 | { |
||
| 29 | if (is_int($value)) { |
||
| 30 | $value = (float) $value; |
||
| 31 | } |
||
| 32 | |||
| 33 | if (!is_null($this->min) && $value < $this->min) { |
||
| 34 | throw new SchemaAttributeParseException($this, "Provided value '{$value}' is less than the minimum value of {$this->min}"); |
||
| 35 | } |
||
| 36 | |||
| 37 | if (!is_null($this->max) && $value > $this->max) { |
||
| 38 | throw new SchemaAttributeParseException($this, "Provided value '{$value}' is greater than the maximum value of {$this->max}"); |
||
| 39 | } |
||
| 40 | |||
| 41 | if (is_float($value)) { |
||
| 42 | return $value; |
||
| 43 | } |
||
| 44 | |||
| 45 | throw new SchemaAttributeParseException($this, "Provided value '$value' is not a floating-point number"); |
||
| 46 | } |
||
| 47 | } |