Passed
Push — master ( f58ad4...2006a7 )
by Florian
16:38 queued 11s
created

LogicImmoParser   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
dl 0
loc 18
ccs 2
cts 4
cp 0.5
rs 10
c 1
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A parsePhoto() 0 6 2
1
<?php
2
3
namespace App\Parser;
4
5
use App\Enum\Provider;
6
use Exception;
7
use Symfony\Component\DomCrawler\Crawler;
8
9
class LogicImmoParser extends AbstractParser
10
{
11
    protected const PROVIDER = Provider::LOGIC_IMMO;
12
13
    protected const SELECTOR_AD_WRAPPER  = 'td[width="10"] + .full[width="270"]';
14
    protected const SELECTOR_LOCATION    = 'tr:nth-child(3) tr:nth-child(3) a';
15
    protected const SELECTOR_DESCRIPTION = 'tr:nth-child(3) tr:nth-child(4) a';
16
    protected const SELECTOR_PHOTO       = '.background';
17
18
    /**
19
     * {@inheritDoc}
20
     */
21 1
    protected function parsePhoto(Crawler $crawler): ?string
22
    {
23
        try {
24 1
            return $crawler->filter(static::SELECTOR_PHOTO)->attr('background');
25
        } catch (Exception) {
26
            return null;
27
        }
28
    }
29
}
30