Passed
Push — 1.6 ( c2a002 )
by Luis
05:37
created

TraitDefinition   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 23
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A hasAttributes() 0 3 1
1
<?php
2
/**
3
 * PHP version 7.1
4
 *
5
 * This source file is subject to the license that is bundled with this package in the file LICENSE.
6
 */
7
8
namespace PhUml\Code;
9
10
use PhUml\Code\Attributes\HasAttributes;
11
use PhUml\Code\Attributes\WithAttributes;
12
13
class TraitDefinition extends Definition implements HasAttributes, UseTraits
14
{
15
    use WithAttributes, WithTraits;
16
17
    /**
18
     * @param \PhUml\Code\Methods\Method[] $methods
19
     * @param \PhUml\Code\Attributes\Attribute[] $attributes
20
     * @param Name[] $traits
21
     */
22 90
    public function __construct(
23
        Name $name,
24
        array $methods = [],
25
        array $attributes = [],
26
        array $traits = []
27
    ) {
28 90
        parent::__construct($name, $methods);
29 90
        $this->attributes = $attributes;
30 90
        $this->traits = $traits;
31 90
    }
32
33 42
    public function hasAttributes(): bool
34
    {
35 42
        return \count($this->attributes) > 0;
36
    }
37
}
38