Code Duplication    Length = 23-23 lines in 2 locations

src/Parsers/BalanceSheetPage.php 1 location

@@ 57-79 (lines=23) @@
54
     * @param DOMElement $row
55
     * @return array
56
     */
57
    protected function parseTableRow($row)
58
    {
59
        $label = $row->childNodes[0]->nodeValue;
60
        $label = str_replace(':', '', $label);
61
        $label = str_replace('(*)', '', $label);
62
        $label = str_replace('(**)', '', $label);
63
        $label = str_replace("\n", ' ', $label);
64
        $label = str_replace("\t", ' ', $label);
65
        $label = preg_replace('/\s+/', ' ', $label);
66
        $label = trim($label);
67
68
        $value = str_replace("\n", ' ', $row->childNodes[2]->nodeValue);
69
        $value = preg_replace('/\s+/', ' ', $value);
70
        $value = trim($value);
71
72
        $labels = self::getLabelMaps($this->getScraper()->getYear());
73
74
        $labelFind = array_search($label, $labels);
75
        if ($labelFind) {
76
            return [$labelFind, $value];
77
        }
78
        return [];
79
    }
80
81
    /**
82
     * @param $year

src/Parsers/CompanyPage.php 1 location

@@ 65-87 (lines=23) @@
62
     * @param DOMElement $row
63
     * @return array
64
     */
65
    protected function parseTableRow($row)
66
    {
67
        $label = $row->childNodes[0]->nodeValue;
68
        $label = str_replace(':', '', $label);
69
        $label = str_replace('(*)', '', $label);
70
        $label = str_replace('(**)', '', $label);
71
        $label = str_replace("\n", ' ', $label);
72
        $label = str_replace("\t", ' ', $label);
73
        $label = preg_replace('/\s+/', ' ', $label);
74
        $label = trim($label);
75
76
        $value = str_replace("\n", ' ', $row->childNodes[2]->nodeValue);
77
        $value = preg_replace('/\s+/', ' ', $value);
78
        $value = trim($value);
79
80
        $labels = self::getLabelMaps();
81
82
        $labelFind = array_search($label, $labels);
83
        if ($labelFind) {
84
            return [$labelFind, $value];
85
        }
86
        return [];
87
    }
88
89
    /**
90
     * @return array