Method::new()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 3
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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