DocBlockTrait::getDocBlock()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Murtukov\PHPCodeGenerator;
6
7
trait DocBlockTrait
8
{
9
    protected ?Comment $docBlock = null;
10
11 1
    public function getDocBlock(): ?Comment
12
    {
13 1
        return $this->docBlock;
14
    }
15
16 5
    public function setDocBlock(string $text): self
17
    {
18 5
        $this->docBlock = Comment::docBlock($text);
19
20 5
        return $this;
21
    }
22
23 1
    public function createDocBlock(string $text = ''): Comment
24
    {
25 1
        return $this->docBlock = Comment::docBlock($text);
26
    }
27
28 2
    public function removeDocBlock(): self
29
    {
30 2
        $this->docBlock = null;
31
32 2
        return $this;
33
    }
34
35 34
    protected function buildDocBlock()
36
    {
37 34
        $code = '';
38
39 34
        if (null !== $this->docBlock) {
40 7
            $code = "$this->docBlock\n";
41
        }
42
43 34
        return $code;
44
    }
45
}
46