DocumentationTrait   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 34
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A addAnnotation() 0 3 1
A getDocumentation() 0 3 1
A setDocumentation() 0 3 1
1
<?php
2
3
/**
4
 * This file is part of PhpUnitGen.
5
 *
6
 * (c) 2017-2018 Paul Thébaud <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE.md
9
 * file that was distributed with this source code.
10
 */
11
12
namespace PhpUnitGen\Model\PropertyTrait;
13
14
use Doctrine\Common\Collections\Collection;
15
use PhpUnitGen\Annotation\AnnotationInterface\AnnotationInterface;
16
17
/**
18
 * Trait DocumentationTrait.
19
 *
20
 * @author     Paul Thébaud <[email protected]>.
21
 * @copyright  2017-2018 Paul Thébaud <[email protected]>.
22
 * @license    https://opensource.org/licenses/MIT The MIT license.
23
 * @link       https://github.com/paul-thebaud/phpunit-generator
24
 * @since      Class available since Release 2.0.0.
25
 */
26
trait DocumentationTrait
27
{
28
    /**
29
     * @var string|null $documentation The documentation.
30
     */
31
    protected $documentation;
32
33
    /**
34
     * @var Collection|AnnotationInterface[] $annotations The annotations contained in the documentation.
35
     */
36
    protected $annotations;
37
38
    /**
39
     * @param string|null $documentation The new documentation to be set.
40
     */
41
    public function setDocumentation(?string $documentation): void
42
    {
43
        $this->documentation = $documentation;
44
    }
45
46
    /**
47
     * @return string|null The current documentation.
48
     */
49
    public function getDocumentation(): ?string
50
    {
51
        return $this->documentation;
52
    }
53
54
    /**
55
     * @param AnnotationInterface $annotation The annotation to add.
56
     */
57
    public function addAnnotation(AnnotationInterface $annotation): void
58
    {
59
        $this->annotations->add($annotation);
60
    }
61
}
62