SuperimmoNeufParser   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 9
c 0
b 0
f 0
dl 0
loc 18
ccs 4
cts 4
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A parsePhoto() 0 6 1
1
<?php
2
3
namespace App\Parser;
4
5
use App\Enum\Provider;
6
use Symfony\Component\DomCrawler\Crawler;
7
8
class SuperimmoNeufParser extends AbstractParser
9
{
10
    protected const PROVIDER = Provider::SUPERIMMO_NEUF;
11
12
    protected const SELECTOR_AD_WRAPPER  = 'td[style="width: 540px;"]';
13
    protected const SELECTOR_LOCATION    = 'table:nth-child(2) tr:nth-child(2) span';
14
    protected const SELECTOR_TITLE       = 'table:nth-child(2) tr:nth-child(1) span';
15
    protected const SELECTOR_DESCRIPTION = 'table:nth-child(2) tr:nth-child(5) span';
16
17
    /**
18
     * {@inheritDoc}
19
     */
20 1
    protected function parsePhoto(Crawler $crawler): ?string
21
    {
22 1
        $photo = parent::parsePhoto($crawler);
23 1
        $photo = substr($photo, strpos($photo, '#'));
0 ignored issues
show
Bug introduced by
It seems like $photo can also be of type null; however, parameter $haystack of strpos() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

23
        $photo = substr($photo, strpos(/** @scrutinizer ignore-type */ $photo, '#'));
Loading history...
Bug introduced by
It seems like $photo can also be of type null; however, parameter $string of substr() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

23
        $photo = substr(/** @scrutinizer ignore-type */ $photo, strpos($photo, '#'));
Loading history...
24
25 1
        return str_replace('wide', 'biggest', $photo);
26
    }
27
}
28