Passed
Push — develop ( 4c7678...74dbd7 )
by Paul
02:25
created

DocumentationTrait::getConstructorAnnotation()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 0
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
namespace PhpUnitGen\Model\PropertyTrait;
4
5
use Doctrine\Common\Collections\Collection;
6
use PhpUnitGen\Annotation\AnnotationInterface\AnnotationInterface;
7
use PhpUnitGen\Annotation\AssertionAnnotation;
8
use PhpUnitGen\Annotation\ConstructorAnnotation;
9
use PhpUnitGen\Annotation\GetterAnnotation;
10
use PhpUnitGen\Annotation\SetterAnnotation;
11
12
/**
13
 * Trait DocumentationTrait.
14
 *
15
 * @author     Paul Thébaud <[email protected]>.
16
 * @copyright  2017-2018 Paul Thébaud <[email protected]>.
17
 * @license    https://opensource.org/licenses/MIT The MIT license.
18
 * @link       https://github.com/paul-thebaud/phpunit-generator
19
 * @since      Class available since Release 2.0.0.
20
 */
21
trait DocumentationTrait
22
{
23
    /**
24
     * @var string|null $documentation The documentation.
25
     */
26
    protected $documentation;
27
28
    /**
29
     * @var Collection|AnnotationInterface[] $annotations The annotations contained in the documentation.
30
     */
31
    protected $annotations;
32
33
    /**
34
     * @param string|null $documentation The new documentation to be set.
35
     */
36
    public function setDocumentation(?string $documentation): void
37
    {
38
        $this->documentation = $documentation;
39
    }
40
41
    /**
42
     * @return string|null The current documentation.
43
     */
44
    public function getDocumentation(): ?string
45
    {
46
        return $this->documentation;
47
    }
48
49
    /**
50
     * @param AnnotationInterface $annotation The annotation to add.
51
     */
52
    public function addAnnotation(AnnotationInterface $annotation): void
53
    {
54
        $this->annotations->add($annotation);
55
    }
56
}
57