1 | <?php |
||
52 | class Thing implements ThingInterface |
||
53 | { |
||
54 | /** |
||
55 | * Resource types |
||
56 | * |
||
57 | * @var TypeInterface[] |
||
58 | */ |
||
59 | protected $types; |
||
60 | /** |
||
61 | * Resource ID |
||
62 | * |
||
63 | * @var string|null |
||
64 | */ |
||
65 | protected $resourceId = null; |
||
66 | /** |
||
67 | * Child things |
||
68 | * |
||
69 | * @var ThingInterface[] |
||
70 | */ |
||
71 | protected $children = []; |
||
72 | /** |
||
73 | * Property |
||
74 | * |
||
75 | * @var array[] |
||
76 | */ |
||
77 | protected $properties = []; |
||
78 | |||
79 | /** |
||
80 | * Thing constructor |
||
81 | * |
||
82 | * @param TypeInterface|TypeInterface[] $types Type(s) |
||
83 | * @param null|string $resourceId Resource id |
||
84 | */ |
||
85 | 28 | public function __construct($types, $resourceId = null) |
|
104 | |||
105 | /** |
||
106 | * Return the resource types |
||
107 | * |
||
108 | * @return TypeInterface[] Resource types |
||
109 | */ |
||
110 | 7 | public function getTypes() |
|
114 | |||
115 | /** |
||
116 | * Return the resource ID |
||
117 | * |
||
118 | * @return null|string Resource ID |
||
119 | */ |
||
120 | 8 | public function getResourceId() |
|
124 | |||
125 | /** |
||
126 | * Add a property value |
||
127 | * |
||
128 | * @param PropertyInterface $property Property |
||
129 | * @return Thing Self reference |
||
130 | */ |
||
131 | 7 | public function addProperty(PropertyInterface $property) |
|
145 | |||
146 | /** |
||
147 | * Return all properties |
||
148 | * |
||
149 | * @return array[] Properties |
||
150 | */ |
||
151 | 8 | public function getProperties() |
|
155 | |||
156 | /** |
||
157 | * Return the values of a single property |
||
158 | * |
||
159 | * @param string $name Property name |
||
160 | * @param VocabularyInterface $vocabulary Vocabulary |
||
161 | * @return array Property values |
||
162 | */ |
||
163 | 4 | public function getProperty($name, VocabularyInterface $vocabulary) |
|
178 | |||
179 | /** |
||
180 | * Add a child |
||
181 | * |
||
182 | * @param ThingInterface $child Child |
||
183 | * @return Thing Self reference |
||
184 | */ |
||
185 | 9 | public function addChild(ThingInterface $child) |
|
190 | |||
191 | /** |
||
192 | * Return all children |
||
193 | * |
||
194 | * @return ThingInterface[] Children |
||
195 | */ |
||
196 | 9 | public function getChildren() |
|
200 | } |
||
201 |