Bouss /
boussimmo
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace App\Parser; |
||||
| 4 | |||||
| 5 | use App\Enum\Provider; |
||||
| 6 | use Symfony\Component\DomCrawler\Crawler; |
||||
| 7 | |||||
| 8 | class BienIciParser extends AbstractParser |
||||
| 9 | { |
||||
| 10 | protected const PROVIDER = Provider::BIENICI; |
||||
| 11 | |||||
| 12 | protected const SELECTOR_AD_WRAPPER = '.realEstateAd'; |
||||
| 13 | protected const SELECTOR_LOCATION = '.realEstateAdAddress a'; |
||||
| 14 | protected const SELECTOR_BUILDING_NAME = '.realEstateAdTitle strong'; |
||||
| 15 | protected const SELECTOR_DESCRIPTION = '.newProperty'; |
||||
| 16 | |||||
| 17 | /** |
||||
| 18 | * {@inheritDoc} |
||||
| 19 | */ |
||||
| 20 | 1 | protected function parsePhoto(Crawler $crawler): ?string |
|||
| 21 | { |
||||
| 22 | 1 | return str_replace( |
|||
| 23 | 1 | ['200x160', 'width=200&height=160'], |
|||
| 24 | 1 | ['600x370', 'width=600&height=370'], |
|||
| 25 | 1 | parent::parsePhoto($crawler) |
|||
| 26 | ); |
||||
| 27 | } |
||||
| 28 | |||||
| 29 | /** |
||||
| 30 | * {@inheritDoc} |
||||
| 31 | */ |
||||
| 32 | 1 | protected function parseBuildingName(Crawler $crawler): ?string |
|||
| 33 | { |
||||
| 34 | 1 | $title = parent::parseBuildingName($crawler); |
|||
|
0 ignored issues
–
show
|
|||||
| 35 | |||||
| 36 | // E.g.: "Les Jardins d'Antoine (1 à 4 pièces, 32 à 78 m²)" (vs "Appartement 3 pièces 71 m²") |
||||
| 37 | 1 | if (1 === preg_match('/(.+) \(.+\)/', $title, $matches)) { |
|||
|
0 ignored issues
–
show
$title of type null is incompatible with the type string expected by parameter $subject of preg_match().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 38 | return $matches[1]; |
||||
| 39 | } |
||||
| 40 | |||||
| 41 | 1 | return null; |
|||
| 42 | } |
||||
| 43 | } |
||||
| 44 |
This check looks for function or method calls that always return null and whose return value is assigned to a variable.
The method
getObject()can return nothing but null, so it makes no sense to assign that value to a variable.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.