@@ -455,7 +455,7 @@ |
||
455 | 455 | * Additionally, the chosen content language is inserted with the highest priority |
456 | 456 | * and the vocab default language is inserted with the lowest priority. |
457 | 457 | * @param string $clang |
458 | - * @return array of language code strings |
|
458 | + * @return string[] of language code strings |
|
459 | 459 | */ |
460 | 460 | public function getLanguageOrder($clang) |
461 | 461 | { |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | { |
25 | 25 | $label = is_string($this->getLabel()) ? $this->getLabel() : $this->getLabel()->getValue(); |
26 | 26 | if ($this->vocab->getConfig()->sortByNotation()) { |
27 | - $label = $this->getNotation() . $label; |
|
27 | + $label = $this->getNotation().$label; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | return $label; |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | } |
48 | 48 | // We need to check all the labels in case one of them matches a subtag of the current language |
49 | 49 | if ($this->resource->allLiterals('skos:prefLabel')) { |
50 | - foreach($this->resource->allLiterals('skos:prefLabel') as $label) { |
|
50 | + foreach ($this->resource->allLiterals('skos:prefLabel') as $label) { |
|
51 | 51 | // the label lang code is a subtag of the UI lang eg. en-GB - create a new literal with the main language |
52 | - if ($label !== null && strpos($label->getLang(), $fallback . '-') === 0) { |
|
52 | + if ($label !== null && strpos($label->getLang(), $fallback.'-') === 0) { |
|
53 | 53 | return EasyRdf\Literal::create($label, $fallback); |
54 | 54 | } |
55 | 55 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | public function getReifiedPropertyValues() { |
138 | 138 | $ret = array(); |
139 | 139 | $props = $this->resource->propertyUris(); |
140 | - foreach($props as $prop) { |
|
140 | + foreach ($props as $prop) { |
|
141 | 141 | $prop = (EasyRdf\RdfNamespace::shorten($prop) !== null) ? EasyRdf\RdfNamespace::shorten($prop) : $prop; |
142 | 142 | foreach ($this->resource->allLiterals($prop) as $val) { |
143 | 143 | if ($prop !== 'rdf:value' && $this->resource->get($prop)) { // shown elsewhere |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | return $this->resource->label($fallback); |
114 | 114 | } |
115 | 115 | // We need to check all the labels in case one of them matches a subtag of the current language |
116 | - foreach($this->resource->allLiterals('skos:prefLabel') as $label) { |
|
116 | + foreach ($this->resource->allLiterals('skos:prefLabel') as $label) { |
|
117 | 117 | // the label lang code is a subtag of the UI lang eg. en-GB - create a new literal with the main language |
118 | - if ($label !== null && strpos($label->getLang(), $fallback . '-') === 0) { |
|
118 | + if ($label !== null && strpos($label->getLang(), $fallback.'-') === 0) { |
|
119 | 119 | return EasyRdf\Literal::create($label, $fallback); |
120 | 120 | } |
121 | 121 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | public function hasXlLabel($prop = 'prefLabel') |
138 | 138 | { |
139 | - if ($this->resource->hasProperty('skosxl:' . $prop)) { |
|
139 | + if ($this->resource->hasProperty('skosxl:'.$prop)) { |
|
140 | 140 | return true; |
141 | 141 | } |
142 | 142 | return false; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | public function getXlLabel() |
146 | 146 | { |
147 | 147 | $labels = $this->resource->allResources('skosxl:prefLabel'); |
148 | - foreach($labels as $labres) { |
|
148 | + foreach ($labels as $labres) { |
|
149 | 149 | $label = $labres->getLiteral('skosxl:literalForm'); |
150 | 150 | if ($label !== null && $label->getLang() == $this->clang) { |
151 | 151 | return new LabelSkosXL($this->model, $labres); |
@@ -356,9 +356,9 @@ discard block |
||
356 | 356 | // if not found in current vocabulary, look up in the default graph to be able |
357 | 357 | // to read an ontology loaded in a separate graph |
358 | 358 | // note that this imply that the property has an rdf:type declared for the query to work |
359 | - if(!$proplabel) { |
|
359 | + if (!$proplabel) { |
|
360 | 360 | $envLangLabels = $this->model->getDefaultSparql()->queryLabel($longUri, $this->getEnvLang()); |
361 | - $proplabel = ($envLangLabels)?$envLangLabels[$this->getEnvLang()]:$this->model->getDefaultSparql()->queryLabel($longUri, '')['']; |
|
361 | + $proplabel = ($envLangLabels) ? $envLangLabels[$this->getEnvLang()] : $this->model->getDefaultSparql()->queryLabel($longUri, '')['']; |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | // look for superproperties in the current graph |
@@ -368,12 +368,12 @@ discard block |
||
368 | 368 | } |
369 | 369 | |
370 | 370 | // also look up superprops in the default graph if not found in current vocabulary |
371 | - if(!$superprops || empty($superprops)) { |
|
371 | + if (!$superprops || empty($superprops)) { |
|
372 | 372 | $superprops = $this->model->getDefaultSparql()->querySuperProperties($longUri); |
373 | 373 | } |
374 | 374 | |
375 | 375 | // we're reading only one super property, even if there are multiple ones |
376 | - $superprop = ($superprops)?$superprops[0]:null; |
|
376 | + $superprop = ($superprops) ? $superprops[0] : null; |
|
377 | 377 | if ($superprop) { |
378 | 378 | $superprop = EasyRdf\RdfNamespace::shorten($superprop) ? EasyRdf\RdfNamespace::shorten($superprop) : $superprop; |
379 | 379 | } |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | } |
386 | 386 | |
387 | 387 | // searching for subproperties of literals too |
388 | - if($superprops) { |
|
388 | + if ($superprops) { |
|
389 | 389 | foreach ($superprops as $subi) { |
390 | 390 | $suburi = EasyRdf\RdfNamespace::shorten($subi) ? EasyRdf\RdfNamespace::shorten($subi) : $subi; |
391 | 391 | $duplicates[$suburi] = $prop; |
@@ -505,14 +505,14 @@ discard block |
||
505 | 505 | |
506 | 506 | // making a human readable string from the timestamps |
507 | 507 | if ($created != '') { |
508 | - $ret = gettext('skosmos:created') . ' ' . (Punic\Calendar::formatDate($created, 'short')); |
|
508 | + $ret = gettext('skosmos:created').' '.(Punic\Calendar::formatDate($created, 'short')); |
|
509 | 509 | } |
510 | 510 | |
511 | 511 | if ($modified != '') { |
512 | 512 | if ($created != '') { |
513 | - $ret .= ', ' . gettext('skosmos:modified') . ' ' . (Punic\Calendar::formatDate($modified, 'short')); |
|
513 | + $ret .= ', '.gettext('skosmos:modified').' '.(Punic\Calendar::formatDate($modified, 'short')); |
|
514 | 514 | } else { |
515 | - $ret .= ' ' . ucfirst(gettext('skosmos:modified')) . ' ' . (Punic\Calendar::formatDate($modified, 'short')); |
|
515 | + $ret .= ' '.ucfirst(gettext('skosmos:modified')).' '.(Punic\Calendar::formatDate($modified, 'short')); |
|
516 | 516 | } |
517 | 517 | |
518 | 518 | } |
@@ -520,12 +520,12 @@ discard block |
||
520 | 520 | trigger_error($e->getMessage(), E_USER_WARNING); |
521 | 521 | $ret = ''; |
522 | 522 | if ($this->resource->get('dc:modified')) { |
523 | - $modified = (string) $this->resource->get('dc:modified'); |
|
524 | - $ret = gettext('skosmos:modified') . ' ' . $modified; |
|
523 | + $modified = (string)$this->resource->get('dc:modified'); |
|
524 | + $ret = gettext('skosmos:modified').' '.$modified; |
|
525 | 525 | } |
526 | 526 | if ($this->resource->get('dc:created')) { |
527 | - $created .= (string) $this->resource->get('dc:created'); |
|
528 | - $ret .= ' ' . gettext('skosmos:created') . ' ' . $created; |
|
527 | + $created .= (string)$this->resource->get('dc:created'); |
|
528 | + $ret .= ' '.gettext('skosmos:created').' '.$created; |
|
529 | 529 | } |
530 | 530 | } |
531 | 531 | return $ret; |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | $ret = array(); |
636 | 636 | foreach ($labels as $lit) { |
637 | 637 | // filtering away subsets of the current language eg. en vs en-GB |
638 | - if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang() . '-') !== 0) { |
|
638 | + if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang().'-') !== 0) { |
|
639 | 639 | $prop = in_array($lit, $prefLabels) ? 'skos:prefLabel' : 'skos:altLabel'; |
640 | 640 | $ret[$this->literalLanguageToString($lit)][] = new ConceptPropertyValueLiteral($this->model, $this->vocab, $this->resource, $lit, $prop); |
641 | 641 | } |