Method   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
dl 0
loc 22
ccs 9
cts 9
cp 1
rs 10
c 1
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A new() 0 3 1
A __construct() 0 4 1
A generate() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Murtukov\PHPCodeGenerator;
6
7
class Method extends AbstractFunction implements BlockInterface
8
{
9
    use ScopedContentTrait;
10
    use DocBlockTrait;
11
12 8
    public function __construct(string $name, string $modifier = Modifier::PUBLIC, string $returnType = '')
13
    {
14 8
        $this->signature = new Signature($name, $modifier, $returnType);
15 8
        $this->dependencyAwareChildren = [$this->signature];
16 8
    }
17
18 4
    public static function new(string $name, string $modifier = Modifier::PUBLIC, string $returnType = ''): self
19
    {
20 4
        return new static($name, $modifier, $returnType);
21
    }
22
23 11
    public function generate(): string
24
    {
25
        return <<<CODE
26 11
        {$this->buildDocBlock()}{$this->signature->generate(false)}
27
        {
28 11
        {$this->generateContent()}
29
        }
30
        CODE;
31
    }
32
}
33