@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | } elseif ($parts[1] == 'data') { |
38 | 38 | $controller->data($request); |
39 | 39 | } elseif (sizeof($parts) == 2) { |
40 | - header("Location: " . $parts[1] . "/"); |
|
40 | + header("Location: ".$parts[1]."/"); |
|
41 | 41 | } else { |
42 | 42 | $vocab = $parts[1]; |
43 | 43 | try { |
@@ -93,5 +93,5 @@ discard block |
||
93 | 93 | } |
94 | 94 | } catch (Exception $e) { |
95 | 95 | header("HTTP/1.0 500 Internal Server Error"); |
96 | - echo('ERROR: ' . $e->getMessage()); |
|
96 | + echo('ERROR: '.$e->getMessage()); |
|
97 | 97 | } |
@@ -23,5 +23,5 @@ |
||
23 | 23 | |
24 | 24 | } catch (Exception $e) { |
25 | 25 | header("HTTP/1.0 500 Internal Server Error"); |
26 | - echo('ERROR: ' . $e->getMessage()); |
|
26 | + echo('ERROR: '.$e->getMessage()); |
|
27 | 27 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | } |
15 | 15 | require_once 'vendor/autoload.php'; |
16 | 16 | } catch (Exception $e) { |
17 | - echo "Error: " . $e->getMessage(); |
|
17 | + echo "Error: ".$e->getMessage(); |
|
18 | 18 | return; |
19 | 19 | } |
20 | 20 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | // if language code missing, redirect to guessed language |
33 | 33 | // in any case, redirect to <lang>/ |
34 | 34 | $lang = sizeof($parts) == 2 && $parts[1] !== '' ? $parts[1] : $controller->guessLanguage(); |
35 | - header("Location: " . $lang . "/"); |
|
35 | + header("Location: ".$lang."/"); |
|
36 | 36 | } else { |
37 | 37 | if (array_key_exists($parts[1], $config->getLanguages())) { // global pages |
38 | 38 | $request->setLang($parts[1]); |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | } |
62 | 62 | if (sizeof($parts) == 3) { // language code missing |
63 | 63 | $lang = $controller->guessLanguage(); |
64 | - $newurl = $controller->getBaseHref() . $vocab . "/" . $lang . "/"; |
|
65 | - header("Location: " . $newurl); |
|
64 | + $newurl = $controller->getBaseHref().$vocab."/".$lang."/"; |
|
65 | + header("Location: ".$newurl); |
|
66 | 66 | } else { |
67 | 67 | if (array_key_exists($parts[2], $config->getLanguages())) { |
68 | 68 | $lang = $parts[2]; |
@@ -103,10 +103,10 @@ discard block |
||
103 | 103 | } |
104 | 104 | } else { // language code missing, redirect to some language version |
105 | 105 | $lang = $controller->guessLanguage($vocab); |
106 | - $newurl = $controller->getBaseHref() . $vocab . "/" . $lang . "/" . implode('/', array_slice($parts, 2)); |
|
106 | + $newurl = $controller->getBaseHref().$vocab."/".$lang."/".implode('/', array_slice($parts, 2)); |
|
107 | 107 | $qs = $request->getServerConstant('QUERY_STRING'); |
108 | 108 | if ($qs) { |
109 | - $newurl .= "?" . $qs; |
|
109 | + $newurl .= "?".$qs; |
|
110 | 110 | } |
111 | 111 | header("Location: $newurl"); |
112 | 112 | } |
@@ -124,8 +124,8 @@ |
||
124 | 124 | */ |
125 | 125 | public function getEnvLang() |
126 | 126 | { |
127 | - // get language from locale, same as used by gettext, set by Controller |
|
128 | - return substr(getenv("LC_ALL"), 0, 2); // @codeCoverageIgnore |
|
127 | + // get language from locale, same as used by gettext, set by Controller |
|
128 | + return substr(getenv("LC_ALL"), 0, 2); // @codeCoverageIgnore |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | return isset($results[$lang]) ? $results[$lang] : null; |
53 | 53 | } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
54 | 54 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
55 | - error_log('Caught exception: ' . $e->getMessage()); |
|
55 | + error_log('Caught exception: '.$e->getMessage()); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | return isset($results) ? $results : null; |
75 | 75 | } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
76 | 76 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
77 | - error_log('Caught exception: ' . $e->getMessage()); |
|
77 | + error_log('Caught exception: '.$e->getMessage()); |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | /** |
20 | 20 | * Wraps apc_store() and apcu_store() |
21 | 21 | */ |
22 | - public function store($key, $value, $ttl=3600) { |
|
22 | + public function store($key, $value, $ttl = 3600) { |
|
23 | 23 | if (function_exists('apcu_store')) { |
24 | 24 | return apcu_store($key, $value, $ttl); |
25 | 25 | } |
@@ -84,7 +84,7 @@ |
||
84 | 84 | foreach (explode(' ', GLOBAL_PLUGINS) as $pluginName) { |
85 | 85 | $globalPluginsArray[] = "\"$pluginName\""; |
86 | 86 | } |
87 | - $globalPlugins = " " . implode(', ', $globalPluginsArray) . " "; |
|
87 | + $globalPlugins = " ".implode(', ', $globalPluginsArray)." "; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | # print the prefixes |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | public function getPrefLabel() { |
12 | 12 | $label = null; |
13 | 13 | $labels = $this->resource->allResources('skosxl:prefLabel'); |
14 | - foreach($labels as $labres) { |
|
14 | + foreach ($labels as $labres) { |
|
15 | 15 | $label = $labres->getLiteral('skosxl:literalForm'); |
16 | 16 | if ($label->getLang() == $this->clang) { |
17 | 17 | return $label; |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | public function getProperties() { |
24 | 24 | $ret = array(); |
25 | 25 | $props = $this->resource->properties(); |
26 | - foreach($props as $prop) { |
|
26 | + foreach ($props as $prop) { |
|
27 | 27 | if ($prop !== 'skosxl:prefLabel') { |
28 | 28 | $ret[$prop] = $this->resource->get($prop); |
29 | 29 | } |
@@ -517,13 +517,13 @@ |
||
517 | 517 | |
518 | 518 | $defaultPropLabel = $this->model->getDefaultSparql()->queryLabel($longUri, ''); |
519 | 519 | |
520 | - if($envLangLabels) { |
|
521 | - $proplabel = $envLangLabels[$this->getEnvLang()]; |
|
520 | + if($envLangLabels) { |
|
521 | + $proplabel = $envLangLabels[$this->getEnvLang()]; |
|
522 | 522 | } else { |
523 | - if($defaultPropLabel) { |
|
524 | - $proplabel = $defaultPropLabel['']; |
|
525 | - } |
|
526 | - } |
|
523 | + if($defaultPropLabel) { |
|
524 | + $proplabel = $defaultPropLabel['']; |
|
525 | + } |
|
526 | + } |
|
527 | 527 | } |
528 | 528 | |
529 | 529 | // look for superproperties in the current graph |
@@ -136,9 +136,9 @@ discard block |
||
136 | 136 | return $this->resource->label($fallback); |
137 | 137 | } |
138 | 138 | // We need to check all the labels in case one of them matches a subtag of the current language |
139 | - foreach($this->resource->allLiterals('skos:prefLabel') as $label) { |
|
139 | + foreach ($this->resource->allLiterals('skos:prefLabel') as $label) { |
|
140 | 140 | // the label lang code is a subtag of the UI lang eg. en-GB - create a new literal with the main language |
141 | - if ($label !== null && strpos($label->getLang(), $fallback . '-') === 0) { |
|
141 | + if ($label !== null && strpos($label->getLang(), $fallback.'-') === 0) { |
|
142 | 142 | return EasyRdf\Literal::create($label, $fallback); |
143 | 143 | } |
144 | 144 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | |
160 | 160 | public function hasXlLabel($prop = 'prefLabel') |
161 | 161 | { |
162 | - if ($this->resource->hasProperty('skosxl:' . $prop)) { |
|
162 | + if ($this->resource->hasProperty('skosxl:'.$prop)) { |
|
163 | 163 | return true; |
164 | 164 | } |
165 | 165 | return false; |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | public function getXlLabel() |
169 | 169 | { |
170 | 170 | $labels = $this->resource->allResources('skosxl:prefLabel'); |
171 | - foreach($labels as $labres) { |
|
171 | + foreach ($labels as $labres) { |
|
172 | 172 | $label = $labres->getLiteral('skosxl:literalForm'); |
173 | 173 | if ($label !== null && $label->getLang() == $this->clang) { |
174 | 174 | return new LabelSkosXL($this->model, $labres); |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | // catch external subjects that have $res as object |
276 | 276 | $extSubjects = $exGraph->resourcesMatching("schema:about", $res); |
277 | 277 | |
278 | - $propList = array_unique(array_merge( |
|
278 | + $propList = array_unique(array_merge( |
|
279 | 279 | $this->DEFAULT_EXT_PROPERTIES, |
280 | 280 | $this->getVocab()->getConfig()->getExtProperties(), |
281 | 281 | $this->getVocab()->getConfig()->getPluginRegister()->getExtProperties() |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * @param string[] $seen Processed resources so far |
301 | 301 | * @param string[] $props (optional) limit to these property URIs |
302 | 302 | */ |
303 | - private function addExternalTriplesToGraph($res, &$seen, $props=null) |
|
303 | + private function addExternalTriplesToGraph($res, &$seen, $props = null) |
|
304 | 304 | { |
305 | 305 | if (array_key_exists($res->getUri(), $seen) && $seen[$res->getUri()] === 0) { |
306 | 306 | return; |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | */ |
331 | 331 | private function addPropertyValues($res, $prop, &$seen) |
332 | 332 | { |
333 | - $resList = $res->allResources('<' . $prop . '>'); |
|
333 | + $resList = $res->allResources('<'.$prop.'>'); |
|
334 | 334 | |
335 | 335 | foreach ($resList as $res2) { |
336 | 336 | if ($res2->isBNode()) { |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | $this->addResourceReifications($res, $prop, $res2, $seen); |
341 | 341 | } |
342 | 342 | |
343 | - $litList = $res->allLiterals('<' . $prop . '>'); |
|
343 | + $litList = $res->allLiterals('<'.$prop.'>'); |
|
344 | 344 | |
345 | 345 | foreach ($litList as $lit) { |
346 | 346 | $this->graph->addLiteral($res, $prop, $lit); |
@@ -528,15 +528,15 @@ discard block |
||
528 | 528 | // if not found in current vocabulary, look up in the default graph to be able |
529 | 529 | // to read an ontology loaded in a separate graph |
530 | 530 | // note that this imply that the property has an rdf:type declared for the query to work |
531 | - if(!$is_well_known && !$proplabel) { |
|
531 | + if (!$is_well_known && !$proplabel) { |
|
532 | 532 | $envLangLabels = $this->model->getDefaultSparql()->queryLabel($longUri, $this->getEnvLang()); |
533 | 533 | |
534 | 534 | $defaultPropLabel = $this->model->getDefaultSparql()->queryLabel($longUri, ''); |
535 | 535 | |
536 | - if($envLangLabels) { |
|
536 | + if ($envLangLabels) { |
|
537 | 537 | $proplabel = $envLangLabels[$this->getEnvLang()]; |
538 | 538 | } else { |
539 | - if($defaultPropLabel) { |
|
539 | + if ($defaultPropLabel) { |
|
540 | 540 | $proplabel = $defaultPropLabel['']; |
541 | 541 | } |
542 | 542 | } |
@@ -549,12 +549,12 @@ discard block |
||
549 | 549 | } |
550 | 550 | |
551 | 551 | // also look up superprops in the default graph if not found in current vocabulary |
552 | - if(!$is_well_known && (!$superprops || empty($superprops))) { |
|
552 | + if (!$is_well_known && (!$superprops || empty($superprops))) { |
|
553 | 553 | $superprops = $this->model->getDefaultSparql()->querySuperProperties($longUri); |
554 | 554 | } |
555 | 555 | |
556 | 556 | // we're reading only one super property, even if there are multiple ones |
557 | - $superprop = ($superprops)?$superprops[0]:null; |
|
557 | + $superprop = ($superprops) ? $superprops[0] : null; |
|
558 | 558 | if ($superprop) { |
559 | 559 | $superprop = EasyRdf\RdfNamespace::shorten($superprop) ? EasyRdf\RdfNamespace::shorten($superprop) : $superprop; |
560 | 560 | } |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | } |
568 | 568 | |
569 | 569 | // searching for subproperties of literals too |
570 | - if($superprops) { |
|
570 | + if ($superprops) { |
|
571 | 571 | foreach ($superprops as $subi) { |
572 | 572 | $suburi = EasyRdf\RdfNamespace::shorten($subi) ? EasyRdf\RdfNamespace::shorten($subi) : $subi; |
573 | 573 | $duplicates[$suburi] = $prop; |
@@ -729,14 +729,14 @@ discard block |
||
729 | 729 | |
730 | 730 | // making a human readable string from the timestamps |
731 | 731 | if ($created != '') { |
732 | - $ret = gettext('skosmos:created') . ' ' . (Punic\Calendar::formatDate($created, 'short', $this->getEnvLang())); |
|
732 | + $ret = gettext('skosmos:created').' '.(Punic\Calendar::formatDate($created, 'short', $this->getEnvLang())); |
|
733 | 733 | } |
734 | 734 | |
735 | 735 | if ($modified != '') { |
736 | 736 | if ($created != '') { |
737 | - $ret .= ', ' . gettext('skosmos:modified') . ' ' . (Punic\Calendar::formatDate($modified, 'short', $this->getEnvLang())); |
|
737 | + $ret .= ', '.gettext('skosmos:modified').' '.(Punic\Calendar::formatDate($modified, 'short', $this->getEnvLang())); |
|
738 | 738 | } else { |
739 | - $ret .= ' ' . ucfirst(gettext('skosmos:modified')) . ' ' . (Punic\Calendar::formatDate($modified, 'short', $this->getEnvLang())); |
|
739 | + $ret .= ' '.ucfirst(gettext('skosmos:modified')).' '.(Punic\Calendar::formatDate($modified, 'short', $this->getEnvLang())); |
|
740 | 740 | } |
741 | 741 | |
742 | 742 | } |
@@ -744,12 +744,12 @@ discard block |
||
744 | 744 | trigger_error($e->getMessage(), E_USER_WARNING); |
745 | 745 | $ret = ''; |
746 | 746 | if ($this->resource->get('dc:modified')) { |
747 | - $modified = (string) $this->resource->get('dc:modified'); |
|
748 | - $ret = gettext('skosmos:modified') . ' ' . $modified; |
|
747 | + $modified = (string)$this->resource->get('dc:modified'); |
|
748 | + $ret = gettext('skosmos:modified').' '.$modified; |
|
749 | 749 | } |
750 | 750 | if ($this->resource->get('dc:created')) { |
751 | - $created .= (string) $this->resource->get('dc:created'); |
|
752 | - $ret .= ' ' . gettext('skosmos:created') . ' ' . $created; |
|
751 | + $created .= (string)$this->resource->get('dc:created'); |
|
752 | + $ret .= ' '.gettext('skosmos:created').' '.$created; |
|
753 | 753 | } |
754 | 754 | } |
755 | 755 | return $ret; |
@@ -821,7 +821,7 @@ discard block |
||
821 | 821 | $groups[$collLabel] = array($group); |
822 | 822 | |
823 | 823 | $res = $collection; |
824 | - while($super = $this->graph->resourcesMatching('skos:member', $res)) { |
|
824 | + while ($super = $this->graph->resourcesMatching('skos:member', $res)) { |
|
825 | 825 | foreach ($super as $res) { |
826 | 826 | $superprop = new ConceptPropertyValue($this->model, $this->vocab, $res, 'skosmos:memberOfSuper', $this->clang); |
827 | 827 | array_unshift($groups[$collLabel], $superprop); |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | |
867 | 867 | foreach ($labels as $lit) { |
868 | 868 | // filtering away subsets of the current language eg. en vs en-GB |
869 | - if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang() . '-') !== 0) { |
|
869 | + if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang().'-') !== 0) { |
|
870 | 870 | $langCode = $lit->getLang() ? $lit->getLang() : ''; |
871 | 871 | $ret[$langCode][$key][] = new ConceptPropertyValueLiteral($this->model, $this->vocab, $this->resource, $lit, $prop); |
872 | 872 | } |
@@ -958,10 +958,10 @@ discard block |
||
958 | 958 | } |
959 | 959 | else if ($context[$vocabPrefix] !== $vocabUriSpace) { |
960 | 960 | $i = 2; |
961 | - while (isset($context[$vocabPrefix . $i]) && $context[$vocabPrefix . $i] !== $vocabUriSpace) { |
|
961 | + while (isset($context[$vocabPrefix.$i]) && $context[$vocabPrefix.$i] !== $vocabUriSpace) { |
|
962 | 962 | $i += 1; |
963 | 963 | } |
964 | - $context[$vocabPrefix . $i] = $vocabUriSpace; |
|
964 | + $context[$vocabPrefix.$i] = $vocabUriSpace; |
|
965 | 965 | } |
966 | 966 | } |
967 | 967 | $compactJsonLD = \ML\JsonLD\JsonLD::compact($this->graph->serialise('jsonld'), json_encode($context)); |
@@ -30,14 +30,14 @@ |
||
30 | 30 | $url = $baseurl . "$vocid/"; |
31 | 31 | } else { |
32 | 32 | |
33 | - if ($localname !== $uri && $localname === urlencode($localname)) { |
|
34 | - // the URI can be shortened |
|
33 | + if ($localname !== $uri && $localname === urlencode($localname)) { |
|
34 | + // the URI can be shortened |
|
35 | 35 | $url = $baseurl . "$vocid/page/$localname"; |
36 | 36 | } else { |
37 | 37 | // must use full URI |
38 | - $query = http_build_query(array('uri'=>$uri)); |
|
38 | + $query = http_build_query(array('uri'=>$uri)); |
|
39 | 39 | $url = $baseurl . "$vocid/page/?" . $query; |
40 | - } |
|
40 | + } |
|
41 | 41 | } |
42 | 42 | $this->redirect303($url); |
43 | 43 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | $baseurl = $this->getBaseHref(); |
17 | 17 | $vocid = $vocab->getId(); |
18 | 18 | $query = http_build_query(array('uri'=>$uri, 'format'=>$targetFormat)); |
19 | - $url = $baseurl . "rest/v1/$vocid/data?$query"; |
|
19 | + $url = $baseurl."rest/v1/$vocid/data?$query"; |
|
20 | 20 | $this->redirect303($url); |
21 | 21 | } |
22 | 22 | |
@@ -27,16 +27,16 @@ discard block |
||
27 | 27 | $localname = $vocab->getLocalName($uri); |
28 | 28 | |
29 | 29 | if (!$localname) { |
30 | - $url = $baseurl . "$vocid/"; |
|
30 | + $url = $baseurl."$vocid/"; |
|
31 | 31 | } else { |
32 | 32 | |
33 | 33 | if ($localname !== $uri && $localname === urlencode($localname)) { |
34 | 34 | // the URI can be shortened |
35 | - $url = $baseurl . "$vocid/page/$localname"; |
|
35 | + $url = $baseurl."$vocid/page/$localname"; |
|
36 | 36 | } else { |
37 | 37 | // must use full URI |
38 | 38 | $query = http_build_query(array('uri'=>$uri)); |
39 | - $url = $baseurl . "$vocid/page/?" . $query; |
|
39 | + $url = $baseurl."$vocid/page/?".$query; |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | $this->redirect303($url); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | // guess vocabulary based on URI |
58 | 58 | $vocab = $this->model->guessVocabularyFromURI($request->getUri()); |
59 | 59 | if ($vocab === null) { |
60 | - return $this->returnError('404', 'Not Found', 'Unrecognized URI ' . $request->getUri()); |
|
60 | + return $this->returnError('404', 'Not Found', 'Unrecognized URI '.$request->getUri()); |
|
61 | 61 | } |
62 | 62 | $request->setVocab($vocab->getId()); |
63 | 63 | } |