| Conditions | 3 |
| Paths | 5 |
| Total Lines | 12 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 4 |
| CRAP Score | 3.7085 |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | 1 | protected function parsePhoto(Crawler $crawler): ?string |
|
| 23 | { |
||
| 24 | try { |
||
| 25 | 1 | $backgroundImage = $crawler->filter(static::SELECTOR_PHOTO)->attr('style'); |
|
| 26 | |||
| 27 | 1 | if (1 === preg_match('/background-image: url\((.*)\)/', $backgroundImage, $matches)) { |
|
|
|
|||
| 28 | 1 | return $matches[1]; |
|
| 29 | } |
||
| 30 | |||
| 31 | throw new ParseException('Error while parsing the photo: no property "background-image" found'); |
||
| 32 | } catch (Exception $e) { |
||
| 33 | throw new ParseException('Error while parsing the photo: ' . $e->getMessage()); |
||
| 34 | } |
||
| 37 |