Code Duplication    Length = 20-20 lines in 2 locations

src/Parser/JusticeJednatelPersonParser.php 1 location

@@ 9-28 (lines=20) @@
6
use Defr\ValueObject\Person;
7
use Symfony\Component\DomCrawler\Crawler;
8
9
final class JusticeJednatelPersonParser
10
{
11
    /**
12
     * @param Crawler $crawler
13
     *
14
     * @return Person
15
     */
16
    public static function parseFromDomCrawler(Crawler $crawler)
17
    {
18
        $content = $crawler->filter('.div-cell div div')->text();
19
        $content = StringHelper::removeEmptyLines($content);
20
21
        $contentItems = explode("\n", $content);
22
        $contentItems = array_map('trim', $contentItems);
23
        $name = trim(explode(',', $contentItems[0])[0]);
24
25
        $birthday = DateTimeParser::parseFromCzechDateString($contentItems[1]);
26
27
        return new Person($name, $birthday, $contentItems[2]);
28
    }
29
}
30

src/Parser/JusticeSpolecnikPersonParser.php 1 location

@@ 9-28 (lines=20) @@
6
use Defr\ValueObject\Person;
7
use Symfony\Component\DomCrawler\Crawler;
8
9
final class JusticeSpolecnikPersonParser
10
{
11
    /**
12
     * @param Crawler $crawler
13
     *
14
     * @return Person
15
     */
16
    public static function parseFromDomCrawler(Crawler $crawler)
17
    {
18
        $content = $crawler->text();
19
        $content = StringHelper::removeEmptyLines($content);
20
21
        $contentItems = explode("\n", $content);
22
        $contentItems = array_map('trim', $contentItems);
23
        $name = trim(explode(',', $contentItems[1])[0]);
24
25
        $birthday = DateTimeParser::parseFromCzechDateString($contentItems[2]);
26
27
        return new Person($name, $birthday, $contentItems[3]);
28
    }
29
}
30