Total Complexity | 11 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
3 | class LabelSkosXL extends DataObject |
||
4 | { |
||
5 | public function __construct($model, $resource) |
||
6 | { |
||
7 | parent::__construct($model, $resource); |
||
8 | } |
||
9 | |||
10 | public function getPrefLabel() |
||
11 | { |
||
12 | $label = null; |
||
13 | $labels = $this->resource->allResources('skosxl:prefLabel'); |
||
14 | foreach ($labels as $labres) { |
||
15 | $label = $labres->getLiteral('skosxl:literalForm'); |
||
16 | if ($label->getLang() == $this->clang) { |
||
|
|||
17 | return $label; |
||
18 | } |
||
19 | } |
||
20 | return $label; |
||
21 | } |
||
22 | |||
23 | public function getProperties() |
||
24 | { |
||
25 | $ret = array(); |
||
26 | $props = $this->resource->properties(); |
||
27 | foreach ($props as $prop) { |
||
28 | if ($prop !== 'rdf:type' && $prop !== 'skosxl:literalForm') { |
||
29 | // make sure to use the correct gettext keys for DC namespace |
||
30 | $propkey = str_starts_with($prop, 'dc11:') ? |
||
31 | str_replace('dc11:', 'dc:', $prop) : $prop; |
||
32 | $ret[$propkey] = $this->resource->get($prop); |
||
33 | } |
||
34 | } |
||
35 | return $ret; |
||
36 | } |
||
37 | |||
38 | public function getLiteral() |
||
39 | { |
||
40 | return $this->resource->getLiteral('skosxl:literalForm')->getValue(); |
||
41 | } |
||
42 | |||
43 | public function __toString() |
||
46 | } |
||
47 | } |
||
48 |