| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 4 |
| CRAP Score | 3.7085 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 30 | 1 | protected function parseLocation(Crawler $crawler): ?string |
|
| 31 | { |
||
| 32 | try { |
||
| 33 | 1 | $description = trim($crawler->filter(static::SELECTOR_LOCATION)->text()); |
|
| 34 | } catch (Exception) { |
||
| 35 | return null; |
||
| 36 | } |
||
| 37 | |||
| 38 | // E.g.: "- Saint-Herblain (44800)" |
||
| 39 | 1 | if (1 === preg_match('/- ((?:\w+(?:(?:-|\s)\w+)?)+ \(\d+\))(?:$| -)/u', $description, $matches)) { |
|
| 40 | 1 | return $matches[1]; |
|
| 41 | } |
||
| 42 | |||
| 43 | return null; |
||
| 44 | } |
||
| 46 |