Code Duplication    Length = 15-16 lines in 2 locations

src/CommentsGenerator.php 1 location

@@ 18-32 (lines=15) @@
15
    /**
16
     * {@inheritdoc}
17
     */
18
    public function code($indentation = 0) : string
19
    {
20
        $innerIndentation = $this->indentation(1).' * ';
21
22
        $formattedCode = ['/**'];
23
24
        // Prepend inner indentation to code
25
        foreach ($this->code as $codeLine) {
26
            $formattedCode[] = $innerIndentation . $codeLine;
27
        }
28
29
        $formattedCode[] = '**/';
30
31
        return implode("\n" . $this->indentation($indentation), $formattedCode);
32
    }
33
}
34

src/FunctionGenerator.php 1 location

@@ 44-59 (lines=16) @@
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function code($indentation = 0) : string
45
    {
46
        $innerIndentation = $this->indentation(1);
47
48
        $formattedCode = [
49
            $this->buildDefinition(),
50
            '{'
51
        ];
52
        // Prepend inner indentation to code
53
        foreach ($this->code as $codeLine) {
54
            $formattedCode[] = $innerIndentation.$codeLine;
55
        }
56
        $formattedCode[] = '}';
57
58
        return implode("\n".$this->indentation($indentation), $formattedCode);
59
    }
60
}
61