Code Duplication    Length = 17-17 lines in 4 locations

src/Parser/PapercallIo/EventName.php 1 location

@@ 39-55 (lines=17) @@
36
use DOMNode;
37
use DOMXPath;
38
39
class EventName implements EventDetailParserInterface
40
{
41
42
    public function parse(DOMDocument $dom, DOMNode $node, Cfp $cfp) : Cfp
43
    {
44
        $xpath = new DOMXPath($dom);
45
        $titlePath = $xpath->query("//h1[contains(@class, 'subheader__title')]");
46
47
        if (! $titlePath || $titlePath->length == 0) {
48
            throw new \InvalidArgumentException('The CfP does not seem to have an eventname');
49
        }
50
51
        $cfp->conferenceName = trim($titlePath->item(0)->textContent);
52
53
        return $cfp;
54
    }
55
}
56

src/Parser/PapercallIo/EventUri.php 1 location

@@ 38-54 (lines=17) @@
35
use DOMNode;
36
use DOMXPath;
37
38
class EventUri implements EventDetailParserInterface
39
{
40
41
    public function parse(DOMDocument $dom, DOMNode $node, Cfp $cfp) : Cfp
42
    {
43
        $xpath = new DOMXPath($dom);
44
        $uriPath = $xpath->query("//h1/following-sibling::a");
45
46
        if (! $uriPath || $uriPath->length == 0) {
47
            throw new \InvalidArgumentException('The CfP does not seem to have an EventUri');
48
        }
49
50
        $cfp->conferenceUri = trim($uriPath->item(0)->attributes->getNamedItem('href')->textContent);
51
52
        return $cfp;
53
    }
54
}
55

src/Parser/PapercallIo/Icon.php 1 location

@@ 39-55 (lines=17) @@
36
use DOMNode;
37
use DOMXPath;
38
39
class Icon implements EventDetailParserInterface
40
{
41
42
    public function parse(DOMDocument $dom, DOMNode $node, Cfp $cfp) : Cfp
43
    {
44
        $xpath = new DOMXPath($dom);
45
        $titlePath = $xpath->query("//div[contains(@class, 'subheader__logo')]/img");
46
47
        if (! $titlePath || $titlePath->length == 0) {
48
            return $cfp;
49
        }
50
51
        $cfp->iconUri = trim($titlePath->item(0)->attributes->getNamedItem('src')->textContent);
52
53
        return $cfp;
54
    }
55
}
56

src/Parser/PapercallIo/Uri.php 1 location

@@ 38-54 (lines=17) @@
35
use DOMNode;
36
use DOMXPath;
37
38
class Uri implements EventDetailParserInterface
39
{
40
41
    public function parse(DOMDocument $dom, DOMNode $node, Cfp $cfp) : Cfp
42
    {
43
        $xpath = new DOMXPath($dom);
44
        $titlePath = $xpath->query("//a[starts-with(@href, '/cfps/')]");
45
46
        if (! $titlePath || $titlePath->length == 0) {
47
            throw new \InvalidArgumentException('The CfP does not seem to have a CfP-Uri');
48
        }
49
50
        $cfp->uri = 'https://papercall.io' . trim($titlePath->item(0)->attributes->getNamedItem('href')->textContent);
51
52
        return $cfp;
53
    }
54
}
55