Completed
Push — develop ( 763ea8...df26dc )
by Paul
01:58
created

FunctionModel::getParameters()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
c 0
b 0
f 0
rs 10
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
namespace PhpUnitGen\Model;
4
5
use PhpUnitGen\Model\ModelInterface\FunctionModelInterface;
6
use PhpUnitGen\Model\ModelInterface\ParameterModelInterface;
7
use PhpUnitGen\Model\ModelInterface\ReturnModelInterface;
8
use PhpUnitGen\Model\PropertyInterface\ClassLikeInterface;
9
use PhpUnitGen\Model\PropertyTrait\AbstractTrait;
10
use PhpUnitGen\Model\PropertyTrait\FinalTrait;
11
use PhpUnitGen\Model\PropertyTrait\NameTrait;
12
use PhpUnitGen\Model\PropertyTrait\NodeTrait;
13
use PhpUnitGen\Model\PropertyTrait\StaticTrait;
14
use PhpUnitGen\Model\PropertyTrait\VisibilityTrait;
15
16
/**
17
 * Class FunctionModel.
18
 *
19
 * @author     Paul Thébaud <[email protected]>.
20
 * @copyright  2017-2018 Paul Thébaud <[email protected]>.
21
 * @license    https://opensource.org/licenses/MIT The MIT license.
22
 * @link       https://github.com/paul-thebaud/phpunit-generator
23
 * @since      Class available since Release 2.0.0.
24
 */
25
class FunctionModel implements FunctionModelInterface
26
{
27
    use NameTrait;
28
    use VisibilityTrait;
29
    use StaticTrait;
30
    use FinalTrait;
31
    use AbstractTrait;
32
    use NodeTrait;
33
34
    /**
35
     * @var ParameterModel[] $parameters The function methods.
36
     */
37
    private $parameters = [];
38
39
    /**
40
     * @var ReturnModel $return The function return.
41
     */
42
    private $return;
43
44
    /**
45
     * {@inheritdoc}
46
     */
47
    public function addParameter(ParameterModelInterface $parameter): void
48
    {
49
        $this->parameters[] = $parameter;
50
        $parameter->setParentNode($this);
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56
    public function getParameters(): array
57
    {
58
        return $this->parameters;
59
    }
60
61
    /**
62
     * {@inheritdoc}
63
     */
64
    public function setReturn(ReturnModelInterface $return): void
65
    {
66
        $this->setReturn($return);
67
        $return->setParentNode($this);
68
    }
69
70
    /**
71
     * {@inheritdoc}
72
     */
73
    public function getReturn(): ReturnModelInterface
74
    {
75
        return $this->return;
76
    }
77
}
78