1 | <?php declare(strict_types=1); |
||
2 | /** |
||
3 | * This source file is subject to the license that is bundled with this package in the file LICENSE. |
||
4 | */ |
||
5 | |||
6 | namespace PhUml\Code; |
||
7 | |||
8 | use PhUml\Code\Methods\Method; |
||
9 | use PhUml\Code\Properties\Constant; |
||
10 | use PhUml\Code\Properties\EnumCase; |
||
11 | use PhUml\Code\Properties\HasConstants; |
||
12 | use PhUml\Code\Properties\WithConstants; |
||
13 | |||
14 | final class EnumDefinition extends Definition implements HasConstants, UseTraits, ImplementsInterfaces |
||
15 | { |
||
16 | use WithConstants; |
||
17 | use WithTraits; |
||
18 | use WithInterfaces; |
||
19 | |||
20 | /** |
||
21 | * @param Method[] $methods |
||
22 | * @param EnumCase[] $cases |
||
23 | * @param Constant[] $constants |
||
24 | * @param Name[] $interfaces |
||
25 | * @param Name[] $traits |
||
26 | */ |
||
27 | 27 | public function __construct( |
|
28 | Name $name, |
||
29 | private readonly array $cases, |
||
30 | array $methods = [], |
||
31 | array $constants = [], |
||
32 | array $interfaces = [], |
||
33 | array $traits = [], |
||
34 | ) { |
||
35 | 27 | parent::__construct($name, $methods); |
|
36 | 27 | $this->constants = $constants; |
|
37 | 27 | $this->traits = $traits; |
|
38 | 27 | $this->interfaces = $interfaces; |
|
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
39 | } |
||
40 | |||
41 | 11 | public function hasProperties(): bool |
|
42 | { |
||
43 | 11 | return $this->cases !== [] || $this->constants !== []; |
|
44 | } |
||
45 | |||
46 | /** @return EnumCase[] */ |
||
47 | 10 | public function cases(): array |
|
48 | { |
||
49 | 10 | return $this->cases; |
|
50 | } |
||
51 | } |
||
52 |