Passed
Pull Request — master (#22)
by Luis
24:40 queued 21:48
created

TraitDefinition   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
dl 0
loc 24
ccs 6
cts 6
cp 1
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A hasProperties() 0 3 1
1
<?php declare(strict_types=1);
2
/**
3
 * PHP version 8.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\Methods\Method;
0 ignored issues
show
Bug introduced by
The type PhUml\Code\Methods\Method was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use PhUml\Code\Properties\HasProperties;
12
use PhUml\Code\Properties\Property;
13
use PhUml\Code\Properties\WithProperties;
14
15
final class TraitDefinition extends Definition implements HasProperties, UseTraits
16
{
17
    use WithProperties;
18
    use WithTraits;
19
20
    /**
21
     * @param Method[] $methods
22
     * @param Property[] $properties
23
     * @param Name[] $traits
24
     */
25 25
    public function __construct(
26
        Name $name,
27
        array $methods = [],
28
        array $properties = [],
29
        array $traits = []
30
    ) {
31 25
        parent::__construct($name, $methods);
32 25
        $this->properties = $properties;
33 25
        $this->traits = $traits;
34
    }
35
36 10
    public function hasProperties(): bool
37
    {
38 10
        return $this->properties !== [];
39
    }
40
}
41