Code Duplication    Length = 10-10 lines in 2 locations

src/Materizalizer/EvalMaterializer.php 1 location

@@ 13-22 (lines=10) @@
10
     * {@inheritdoc}
11
     * If class already exists - do nothing (prevent from memory leaking)
12
     */
13
    public function materialize(string $code, string $shortClassName, \ReflectionClass $reflection): void
14
    {
15
        if (mb_strpos($code, '<?php') === 0) {
16
            $code = mb_substr($code, 5);
17
        } elseif (mb_strpos($code, '<?') === 0) {
18
            $code = mb_substr($code, 2);
19
        }
20
21
        eval($code);
22
    }
23
}

src/Materizalizer/FileMaterializer.php 1 location

@@ 47-56 (lines=10) @@
44
        return $this->directory . DIRECTORY_SEPARATOR . $className . '.php';
45
    }
46
47
    private function prepareCode(string $code): string
48
    {
49
        if (mb_strpos($code, '<?php') === 0) {
50
            $code = mb_substr($code, 5);
51
        } elseif (mb_strpos($code, '<?') === 0) {
52
            $code = mb_substr($code, 2);
53
        }
54
55
        return "<?php\n" . trim($code);
56
    }
57
58
    private function create(string $filename, string $code): void
59
    {