Code Duplication    Length = 14-14 lines in 2 locations

src/models/TwigPage.php 1 location

@@ 25-38 (lines=14) @@
22
        return Yii::$app->getView()->renderFile($path, $params);
23
    }
24
25
    public function extractData($path)
26
    {
27
        $lines = static::getModule()->readArray($path);
28
        $matterLines = $this->readQuotedLines($lines, '/^{#/', '/#}$/');
29
        if (empty($matterLines)) {
30
            $data = [];
31
            $text = $lines;
32
        } else {
33
            $data = $this->readFrontMatter($matterLines);
34
            $text = array_slice($lines, count($matterLines));
35
        }
36
37
        return [$data, implode("\n", $text)];
38
    }
39
}
40

src/models/AbstractPage.php 1 location

@@ 86-99 (lines=14) @@
83
        return new $class($path);
84
    }
85
86
    public function extractData($path)
87
    {
88
        $lines = static::getModule()->readArray($path);
89
        $yaml = $this->readQuotedLines($lines, '/^---$/', '/^---$/');
90
        if (empty($yaml)) {
91
            $data = [];
92
            $text = $lines;
93
        } else {
94
            $data = $this->readYaml($yaml);
95
            $text = array_slice($lines, count($yaml));
96
        }
97
98
        return [$data, implode("\n", $text)];
99
    }
100
101
    public function readFrontMatter($lines)
102
    {