1 | <?php |
||
14 | class Definition implements LinksAwareInterface |
||
15 | { |
||
16 | use LinksContainer; |
||
17 | |||
18 | /** |
||
19 | * Class covered by definition |
||
20 | * |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $class; |
||
24 | |||
25 | /** |
||
26 | * Attributes |
||
27 | * |
||
28 | * @var Attribute[] |
||
29 | */ |
||
30 | protected $attributes = []; |
||
31 | |||
32 | /** |
||
33 | * Relationships |
||
34 | * |
||
35 | * @var Relationship[] |
||
36 | */ |
||
37 | protected $relationships = []; |
||
38 | |||
39 | /** |
||
40 | * Definition constructor. |
||
41 | * |
||
42 | * @param string $class |
||
43 | */ |
||
44 | 14 | public function __construct(string $class) |
|
48 | |||
49 | /** |
||
50 | * Get class covered by definition |
||
51 | * |
||
52 | * @return string |
||
53 | */ |
||
54 | 2 | public function getClass(): string |
|
58 | |||
59 | /** |
||
60 | * Add attribute |
||
61 | * |
||
62 | * @param Attribute $attribute |
||
63 | * @throws \LogicException |
||
64 | */ |
||
65 | public function addAttribute(Attribute $attribute) |
||
75 | |||
76 | /** |
||
77 | * Get attributes |
||
78 | * |
||
79 | * @return Attribute[] |
||
80 | */ |
||
81 | 1 | public function getAttributes(): array |
|
85 | |||
86 | /** |
||
87 | * Add relationship |
||
88 | * |
||
89 | * @param Relationship $relationship |
||
90 | * @throws \LogicException |
||
91 | */ |
||
92 | 7 | public function addRelationship(Relationship $relationship) |
|
102 | |||
103 | /** |
||
104 | * Get relationships |
||
105 | * |
||
106 | * @return Relationship[] |
||
107 | */ |
||
108 | 6 | public function getRelationships(): array |
|
112 | } |