Code Duplication    Length = 15-15 lines in 2 locations

src/Parser/Lanyrd/EventEndDate.php 1 location

@@ 32-46 (lines=15) @@
29
 */
30
namespace Callingallpapers\Parser\Lanyrd;
31
32
class EventEndDate
33
{
34
35
    public function parse($dom, $xpath)
36
    {
37
        $endDate = $xpath->query("//div[contains(@class, 'vevent')]/*/abbr[contains(@class, 'dtend')]"); ///a/abbr[class='dtstart']
38
        if (! $endDate || $endDate->length == 0) {
39
            throw new \InvalidArgumentException('The Event does not seem to have an end date');
40
        }
41
42
        $endDate = $endDate->item(0)->attributes->getNamedItem('title')->textContent;
43
44
        return new \DateTime($endDate);
45
    }
46
}
47

src/Parser/Lanyrd/EventStartDate.php 1 location

@@ 32-46 (lines=15) @@
29
 */
30
namespace Callingallpapers\Parser\Lanyrd;
31
32
class EventStartDate
33
{
34
35
    public function parse($dom, $xpath)
36
    {
37
        $startDate = $xpath->query("//div[contains(@class, 'vevent')]/*/abbr[contains(@class, 'dtstart')]"); ///a/abbr[class='dtstart']
38
        if (! $startDate || $startDate->length == 0) {
39
            throw new \InvalidArgumentException('The Event does not seem to have a start date');
40
        }
41
42
        $startDate = $startDate->item(0)->attributes->getNamedItem('title')->textContent;
43
44
        return new \DateTime($startDate);
45
    }
46
}
47