Passed
Push — develop ( e84888...251d34 )
by Paul
02:54
created

ClassLikeTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A countFunctions() 0 3 1
A addFunction() 0 3 1
A getFunctions() 0 3 1
1
<?php
2
3
namespace PhpUnitGen\Model\PropertyTrait;
4
5
use PhpUnitGen\Model\ModelInterface\FunctionModelInterface;
6
7
/**
8
 * Trait ClassLikeTrait.
9
 *
10
 * @author     Paul Thébaud <[email protected]>.
11
 * @copyright  2017-2018 Paul Thébaud <[email protected]>.
12
 * @license    https://opensource.org/licenses/MIT The MIT license.
13
 * @link       https://github.com/paul-thebaud/phpunit-generator
14
 * @since      Class available since Release 2.0.0.
15
 */
16
trait ClassLikeTrait
17
{
18
    /**
19
     * @var FunctionModelInterface[] $functions Class functions.
20
     */
21
    private $functions = [];
22
23
    /**
24
     * @param FunctionModelInterface $function The function to add on this parent.
25
     */
26
    public function addFunction(FunctionModelInterface $function): void
27
    {
28
        $this->functions[] = $function;
29
    }
30
31
    /**
32
     * @return FunctionModelInterface[] All the functions contained in this parent.
33
     */
34
    public function getFunctions(): array
35
    {
36
        return $this->functions;
37
    }
38
39
    /**
40
     * @return int The number of function in this parent.
41
     */
42
    public function countFunctions(): int
43
    {
44
        return count($this->functions);
45
    }
46
}
47