Code Duplication    Length = 22-25 lines in 2 locations

src/parser/MarkdownParser.php 1 location

@@ 8-32 (lines=25) @@
5
use Parsedown;
6
use Symfony\Component\Finder\Finder;
7
8
class MarkdownParser extends AbstractParser {
9
10
    /**
11
     * @param string $path
12
     *
13
     * @return string
14
     */
15
    public function parse($path = '*.md') {
16
        $html = '';
17
        $finder = new Finder();
18
        if (!strpos($path, '.md')) {
19
            $path .= '.md';
20
        }
21
        $files = $finder->files()->in("{$this->root}")->path($path);
22
23
        foreach ($files as $file) {
24
            $html = Parsedown::instance()->parse($file->getContents());
25
26
            break;
27
        }
28
29
        return $html;
30
    }
31
32
}
33

src/parser/SassParser.php 1 location

@@ 9-30 (lines=22) @@
6
use Leafo\ScssPhp\Compiler;
7
use Symfony\Component\Finder\Finder;
8
9
class SassParser implements Parser {
10
11
    /**
12
     * @param $path
13
     *
14
     * @return string
15
     */
16
    public function parse($path) {
17
        /** @var Compiler $sass */
18
        $sass = Config::getDependency('engine.sass');
19
        $finder = new Finder();
20
        $files = $finder->files()->in(Config::get('directories.src'))->path(trim($path, '/'));
21
        $data = '';
22
23
        foreach ($files as $file) {
24
            $data .= $sass->compile($file->getContents());
25
        }
26
27
        return $data;
28
    }
29
30
}
31