Completed
Push — develop ( e382f7...b48d9b )
by Paul
02:10
created

FunctionModel::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
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
     * FunctionModel constructor.
49
     */
50
    public function __construct()
51
    {
52
        $this->parameters = new ArrayCollection();
53
    }
54
55
    /**
56
     * {@inheritdoc}
57
     */
58
    public function addParameter(ParameterModelInterface $parameter): void
59
    {
60
        $this->parameters->add($parameter);
61
    }
62
63
    /**
64
     * {@inheritdoc}
65
     */
66
    public function getParameters(): Collection
67
    {
68
        return $this->parameters;
69
    }
70
71
    /**
72
     * {@inheritdoc}
73
     */
74
    public function setReturn(ReturnModelInterface $return): void
75
    {
76
        $this->return = $return;
77
    }
78
79
    /**
80
     * {@inheritdoc}
81
     */
82
    public function getReturn(): ReturnModelInterface
83
    {
84
        return $this->return;
85
    }
86
}
87