| Conditions | 2 |
| Paths | 2 |
| Total Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 36 | public function __construct($description) |
||
| 37 | { |
||
| 38 | $description = trim($description, ' ()'); |
||
| 39 | $regex = '/([0-9e\-+\.]+), *([0-9e\-+\.]+) *\), *\( *([0-9e\-+\.]+), *([0-9e\-+\.]+)/'; |
||
| 40 | |||
| 41 | if (!preg_match($regex, $description, $matches)) { |
||
| 42 | throw new \InvalidArgumentException( |
||
| 43 | sprintf( |
||
| 44 | "Could not parse box representation '%s'.", |
||
| 45 | $description |
||
| 46 | ) |
||
| 47 | ); |
||
| 48 | } |
||
| 49 | |||
| 50 | $this->topX = (float) $matches[1]; |
||
| 51 | $this->topY = (float) $matches[2]; |
||
| 52 | $this->bottomX = (float) $matches[3]; |
||
| 53 | $this->bottomY = (float) $matches[4]; |
||
| 54 | } |
||
| 55 | |||
| 74 |