Conditions | 5 |
Paths | 4 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
37 | 39 | public function get($value) |
|
38 | { |
||
39 | 39 | if (is_numeric($value) and $value > 0) { |
|
40 | 27 | return (double) $value * $this->dpr; |
|
41 | } |
||
42 | |||
43 | 15 | if (preg_match('/^(\d{1,2}(?!\d)|100)(w|h)$/', $value, $matches)) { |
|
44 | 9 | if ($matches[2] === 'h') { |
|
45 | 6 | return (double) $this->image->height() * ($matches[1] / 100); |
|
46 | } |
||
47 | |||
48 | 6 | return (double) $this->image->width() * ($matches[1] / 100); |
|
49 | } |
||
50 | 9 | } |
|
51 | } |
||
52 |