Code Duplication    Length = 14-14 lines in 2 locations

src/models/AbstractPage.php 1 location

@@ 79-92 (lines=14) @@
76
        return new $class($path);
77
    }
78
79
    public function extractData($path)
80
    {
81
        $lines = static::getModule()->readArray($path);
82
        $yaml = $this->getQuoted($lines, '/^---$/', '/^---$/');
83
        if (empty($yaml)) {
84
            $data = [];
85
            $text = $lines;
86
        } else {
87
            $data = $this->readYaml($yaml);
88
            $text = array_slice($lines, count($yaml));
89
        }
90
91
        return [$data, implode("\n", $text)];
92
    }
93
94
    public function readFrontMatter($lines)
95
    {

src/models/TwigPage.php 1 location

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