Code Duplication    Length = 28-29 lines in 2 locations

src/Generator/InterfaceGenerator.php 1 location

@@ 10-37 (lines=28) @@
7
 * @author Igor Vuckovic <[email protected]>
8
 * @license MIT
9
 */
10
class InterfaceGenerator extends ClassAwareGenerator
11
{
12
    /**
13
     * @return string
14
     */
15
    public function generate(): string
16
    {
17
        $output = $this->generateHead();
18
19
        $output .= $this->generateLine('interface ' . $this->name . ($this->extends !== null ? ' extends \\' . ltrim($this->extends, '\\') : ''));
20
        $output .= $this->generateLine('{');
21
22
        $output .= $this->generateConstants();
23
        $output .= $this->generateMethods();
24
25
        $output .= $this->generateFoot();
26
27
        return $output;
28
    }
29
30
    /**
31
     * @inheritDoc
32
     */
33
    protected function getScope(): string
34
    {
35
        return 'interface';
36
    }
37
}
38

src/Generator/TraitGenerator.php 1 location

@@ 10-38 (lines=29) @@
7
 * @author Igor Vuckovic <[email protected]>
8
 * @license MIT
9
 */
10
class TraitGenerator extends ClassAwareGenerator
11
{
12
    /**
13
     * @return string
14
     */
15
    public function generate(): string
16
    {
17
        $output = $this->generateHead();
18
19
        $output .= $this->generateLine('trait ' . $this->name . ($this->extends !== null ? ' extends \\' . ltrim($this->extends, '\\') : ''));
20
        $output .= $this->generateLine('{');
21
22
        $output .= $this->generateConstants();
23
        $output .= $this->generateProperties();
24
        $output .= $this->generateMethods();
25
26
        $output .= $this->generateFoot();
27
28
        return $output;
29
    }
30
31
    /**
32
     * @inheritDoc
33
     */
34
    protected function getScope(): string
35
    {
36
        return 'trait';
37
    }
38
}
39