Completed
Push — master ( 2a5486...81459b )
by Vitaly
02:39
created

CommentsGenerator::code()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 7

Duplication

Lines 15
Ratio 100 %

Importance

Changes 0
Metric Value
dl 15
loc 15
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 7
nc 2
nop 1
1
<?php declare(strict_types = 1);
2
/**
3
 * Created by Vitaly Iegorov <[email protected]>.
4
 * on 03.09.16 at 13:02
5
 */
6
namespace samsonphp\generator;
7
8
/**
9
 * Comments block generator.
10
 *
11
 * @author Vitaly Egorov <[email protected]>
12
 */
13
class CommentsGenerator extends AbstractGenerator
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18 View Code Duplication
    public function code($indentation = 0) : string
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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