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

TraitDefinition::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 4
dl 0
loc 9
ccs 4
cts 4
cp 1
crap 1
rs 9.6666
c 0
b 0
f 0
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