| Total Complexity | 4 |
| Total Lines | 54 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | class InterfaceDefinition extends Definition |
||
| 14 | { |
||
| 15 | /** @var Name[] */ |
||
| 16 | protected $parents; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @param \PhUml\Code\Attributes\Constant[] $constants |
||
| 20 | * @param \PhUml\Code\Methods\Method[] $methods |
||
| 21 | * @param Name[] $parents |
||
| 22 | */ |
||
| 23 | 132 | public function __construct( |
|
| 24 | Name $name, |
||
| 25 | array $constants = [], |
||
| 26 | array $methods = [], |
||
| 27 | array $parents = [] |
||
| 28 | ) { |
||
| 29 | 132 | parent::__construct($name, $constants, $methods); |
|
| 30 | 132 | $this->parents = $parents; |
|
| 31 | 132 | } |
|
| 32 | |||
| 33 | /** |
||
| 34 | * It is used by the `InterfaceGraphBuilder` to create the edge to represent inheritance |
||
| 35 | * |
||
| 36 | * @return Name[] |
||
| 37 | * @see \PhUml\Graphviz\Builders\InterfaceGraphBuilder::extractFrom() for more details |
||
| 38 | */ |
||
| 39 | 72 | public function parents(): array |
|
| 40 | { |
||
| 41 | 72 | return $this->parents; |
|
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * It is used by the `InterfaceGraphBuilder` to determine if an inheritance association should be |
||
| 46 | * created |
||
| 47 | * |
||
| 48 | * @return InterfaceDefinition[] |
||
| 49 | * @see \PhUml\Graphviz\Builders\InterfaceGraphBuilder::extractFrom() for more details |
||
| 50 | */ |
||
| 51 | 3 | public function hasParent(): bool |
|
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * This method is used when the commands are called with the option `hide-empty-blocks` |
||
| 58 | * |
||
| 59 | * It only counts the constants of an interface, since interfaces are not allowed to have |
||
| 60 | * attributes |
||
| 61 | * |
||
| 62 | * @see Definition::hasAttributes() for more details |
||
| 63 | */ |
||
| 64 | 45 | public function hasAttributes(): bool |
|
| 69 |