Code Duplication    Length = 17-20 lines in 2 locations

src/Parser/Lanyrd/Location.php 1 location

@@ 32-48 (lines=17) @@
29
 */
30
namespace Callingallpapers\Parser\Lanyrd;
31
32
class Location
33
{
34
35
    public function parse($dom, $xpath)
36
    {
37
        $locations = $xpath->query("//div[contains(@class, 'vevent')]/p[contains(@class, 'location')]/a"); ///a/abbr[class='dtstart']
38
        if (! $locations || $locations->length == 0) {
39
            throw new \InvalidArgumentException('The Event does not seem to have an end date');
40
        }
41
        $location = [];
42
        foreach ($locations as $item) {
43
            $location[] = trim($item->textContent);
44
        }
45
46
        return implode(', ', array_unique($location));
47
    }
48
}
49

src/Parser/Lanyrd/Tags.php 1 location

@@ 32-51 (lines=20) @@
29
 */
30
namespace Callingallpapers\Parser\Lanyrd;
31
32
class Tags
33
{
34
35
    public function parse($dom, $xpath)
36
    {
37
        $tags = $xpath->query(
38
            "//ul[contains(@class, \"tags\")]/li/a"
39
        );
40
        if (! $tags || $tags->length == 0) {
41
            throw new \InvalidArgumentException('The CfP does not seem to have tags');
42
        }
43
44
        $returntags = [];
45
        foreach ($tags as $tag) {
46
            $returntags[] = trim($tag->textContent);
47
        }
48
49
        return $returntags;
50
    }
51
}
52