Completed
Push — develop ( b48d9b...a124ab )
by Paul
02:06
created

FunctionModel   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 79
rs 10
c 0
b 0
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getParameters() 0 3 1
A isGlobal() 0 3 1
A addParameter() 0 3 1
A getReturn() 0 3 1
A setIsGlobal() 0 3 1
A setReturn() 0 3 1
1
<?php
2
3
namespace PhpUnitGen\Model;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
use Doctrine\Common\Collections\Collection;
7
use PhpUnitGen\Model\ModelInterface\FunctionModelInterface;
8
use PhpUnitGen\Model\ModelInterface\ParameterModelInterface;
9
use PhpUnitGen\Model\ModelInterface\ReturnModelInterface;
10
use PhpUnitGen\Model\PropertyTrait\AbstractTrait;
11
use PhpUnitGen\Model\PropertyTrait\DocumentationTrait;
12
use PhpUnitGen\Model\PropertyTrait\FinalTrait;
13
use PhpUnitGen\Model\PropertyTrait\NameTrait;
14
use PhpUnitGen\Model\PropertyTrait\NodeTrait;
15
use PhpUnitGen\Model\PropertyTrait\StaticTrait;
16
use PhpUnitGen\Model\PropertyTrait\VisibilityTrait;
17
18
/**
19
 * Class FunctionModel.
20
 *
21
 * @author     Paul Thébaud <[email protected]>.
22
 * @copyright  2017-2018 Paul Thébaud <[email protected]>.
23
 * @license    https://opensource.org/licenses/MIT The MIT license.
24
 * @link       https://github.com/paul-thebaud/phpunit-generator
25
 * @since      Class available since Release 2.0.0.
26
 */
27
class FunctionModel implements FunctionModelInterface
28
{
29
    use NameTrait;
30
    use VisibilityTrait;
31
    use StaticTrait;
32
    use FinalTrait;
33
    use AbstractTrait;
34
    use NodeTrait;
35
    use DocumentationTrait;
36
37
    /**
38
     * @var ParameterModelInterface[]|Collection $parameters The function methods.
39
     */
40
    private $parameters;
41
42
    /**
43
     * @var ReturnModelInterface $return The function return.
44
     */
45
    private $return;
46
47
    /**
48
     * @var bool $isGlobal Tells if the function is global.
49
     */
50
    private $isGlobal = false;
51
52
    /**
53
     * FunctionModel constructor.
54
     */
55
    public function __construct()
56
    {
57
        $this->parameters = new ArrayCollection();
58
    }
59
60
    /**
61
     * {@inheritdoc}
62
     */
63
    public function addParameter(ParameterModelInterface $parameter): void
64
    {
65
        $this->parameters->add($parameter);
66
    }
67
68
    /**
69
     * {@inheritdoc}
70
     */
71
    public function getParameters(): Collection
72
    {
73
        return $this->parameters;
74
    }
75
76
    /**
77
     * {@inheritdoc}
78
     */
79
    public function setReturn(ReturnModelInterface $return): void
80
    {
81
        $this->return = $return;
82
    }
83
84
    /**
85
     * {@inheritdoc}
86
     */
87
    public function getReturn(): ReturnModelInterface
88
    {
89
        return $this->return;
90
    }
91
92
    /**
93
     * {@inheritdoc}
94
     */
95
    public function setIsGlobal(bool $isGlobal): void
96
    {
97
        $this->isGlobal = true;
98
    }
99
100
    /**
101
     * {@inheritdoc}
102
     */
103
    public function isGlobal(): bool
104
    {
105
        return $this->isGlobal;
106
    }
107
}
108