| Conditions | 6 |
| Paths | 4 |
| Total Lines | 25 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | public function validate($ratio, $config, $context) |
||
| 19 | { |
||
| 20 | $ratio = $this->parseCDATA($ratio); |
||
| 21 | |||
| 22 | $parts = explode('/', $ratio, 2); |
||
| 23 | $length = count($parts); |
||
| 24 | |||
| 25 | if ($length < 1 || $length > 2) { |
||
| 26 | return false; |
||
| 27 | } |
||
| 28 | |||
| 29 | $num = new \HTMLPurifier_AttrDef_CSS_Number(); |
||
| 30 | |||
| 31 | if ($length === 1) { |
||
| 32 | return $num->validate($parts[0], $config, $context); |
||
| 33 | } |
||
| 34 | |||
| 35 | $num1 = $num->validate($parts[0], $config, $context); |
||
| 36 | $num2 = $num->validate($parts[1], $config, $context); |
||
| 37 | |||
| 38 | if ($num1 === false || $num2 === false) { |
||
| 39 | return false; |
||
| 40 | } |
||
| 41 | |||
| 42 | return $num1 . '/' . $num2; |
||
| 43 | } |
||
| 47 |