@@ -76,10 +76,12 @@ |
||
76 | 76 | */ |
77 | 77 | public function getUriSpace() |
78 | 78 | { |
79 | - if ($this->urispace === null) // initialize cache |
|
79 | + if ($this->urispace === null) { |
|
80 | + // initialize cache |
|
80 | 81 | { |
81 | 82 | $this->urispace = $this->resource->getLiteral('void:uriSpace')->getValue(); |
82 | 83 | } |
84 | + } |
|
83 | 85 | |
84 | 86 | return $this->urispace; |
85 | 87 | } |
@@ -163,10 +163,10 @@ discard block |
||
163 | 163 | $sparql = $this->getSparql(); |
164 | 164 | $result = $sparql->queryConceptScheme($defaultcs); |
165 | 165 | } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
166 | - if ($this->model->getConfig()->getLogCaughtExceptions()) { |
|
167 | - error_log('Caught exception: ' . $e->getMessage()); |
|
168 | - } |
|
169 | - return null; |
|
166 | + if ($this->model->getConfig()->getLogCaughtExceptions()) { |
|
167 | + error_log('Caught exception: ' . $e->getMessage()); |
|
168 | + } |
|
169 | + return null; |
|
170 | 170 | } |
171 | 171 | $conceptscheme = $result->resource($defaultcs); |
172 | 172 | $this->order = array( |
@@ -253,9 +253,9 @@ discard block |
||
253 | 253 | try { |
254 | 254 | $conceptSchemes = $this->getSparql()->queryConceptSchemes($lang); |
255 | 255 | } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
256 | - if ($this->model->getConfig()->getLogCaughtExceptions()) { |
|
257 | - error_log('Caught exception: ' . $e->getMessage()); |
|
258 | - } |
|
256 | + if ($this->model->getConfig()->getLogCaughtExceptions()) { |
|
257 | + error_log('Caught exception: ' . $e->getMessage()); |
|
258 | + } |
|
259 | 259 | } |
260 | 260 | return $conceptSchemes; |
261 | 261 | } |
@@ -453,9 +453,9 @@ discard block |
||
453 | 453 | try { |
454 | 454 | $conceptInfo = $sparql->queryConceptInfo($uri, $this->config->getArrayClassURI(), array($this), $clang); |
455 | 455 | } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
456 | - if ($this->model->getConfig()->getLogCaughtExceptions()) { |
|
457 | - error_log('Caught exception: ' . $e->getMessage()); |
|
458 | - } |
|
456 | + if ($this->model->getConfig()->getLogCaughtExceptions()) { |
|
457 | + error_log('Caught exception: ' . $e->getMessage()); |
|
458 | + } |
|
459 | 459 | } |
460 | 460 | return $conceptInfo; |
461 | 461 | } |
@@ -79,10 +79,12 @@ |
||
79 | 79 | if ($sortable !== null) { |
80 | 80 | uksort($sortable, array($this, 'mycompare')); |
81 | 81 | foreach ($sortable as $prop => $vals) { |
82 | - if (is_array($prop)) // the ConceptProperty objects have their own sorting methods |
|
82 | + if (is_array($prop)) { |
|
83 | + // the ConceptProperty objects have their own sorting methods |
|
83 | 84 | { |
84 | 85 | ksort($sortable[$prop]); |
85 | 86 | } |
87 | + } |
|
86 | 88 | } |
87 | 89 | } |
88 | 90 | return $sortable; |
@@ -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 | /** |
@@ -400,7 +400,9 @@ discard block |
||
400 | 400 | $hits[] = $res; |
401 | 401 | } |
402 | 402 | } |
403 | - if (sizeof($hits) > 0) return $hits; |
|
403 | + if (sizeof($hits) > 0) { |
|
404 | + return $hits; |
|
405 | + } |
|
404 | 406 | |
405 | 407 | // case 2: case-insensitive match on preferred label |
406 | 408 | foreach ($results as $res) { |
@@ -408,7 +410,9 @@ discard block |
||
408 | 410 | $hits[] = $res; |
409 | 411 | } |
410 | 412 | } |
411 | - if (sizeof($hits) > 0) return $hits; |
|
413 | + if (sizeof($hits) > 0) { |
|
414 | + return $hits; |
|
415 | + } |
|
412 | 416 | |
413 | 417 | if ($lang === null) { |
414 | 418 | // case 1A: exact match on preferred label in any language |
@@ -419,7 +423,9 @@ discard block |
||
419 | 423 | $hits[] = $res; |
420 | 424 | } |
421 | 425 | } |
422 | - if (sizeof($hits) > 0) return $hits; |
|
426 | + if (sizeof($hits) > 0) { |
|
427 | + return $hits; |
|
428 | + } |
|
423 | 429 | |
424 | 430 | // case 2A: case-insensitive match on preferred label in any language |
425 | 431 | foreach ($results as $res) { |
@@ -429,7 +435,9 @@ discard block |
||
429 | 435 | $hits[] = $res; |
430 | 436 | } |
431 | 437 | } |
432 | - if (sizeof($hits) > 0) return $hits; |
|
438 | + if (sizeof($hits) > 0) { |
|
439 | + return $hits; |
|
440 | + } |
|
433 | 441 | } |
434 | 442 | |
435 | 443 | // case 3: exact match on alternate label |
@@ -438,7 +446,9 @@ discard block |
||
438 | 446 | $hits[] = $res; |
439 | 447 | } |
440 | 448 | } |
441 | - if (sizeof($hits) > 0) return $hits; |
|
449 | + if (sizeof($hits) > 0) { |
|
450 | + return $hits; |
|
451 | + } |
|
442 | 452 | |
443 | 453 | |
444 | 454 | // case 4: case-insensitive match on alternate label |
@@ -447,7 +457,9 @@ discard block |
||
447 | 457 | $hits[] = $res; |
448 | 458 | } |
449 | 459 | } |
450 | - if (sizeof($hits) > 0) return $hits; |
|
460 | + if (sizeof($hits) > 0) { |
|
461 | + return $hits; |
|
462 | + } |
|
451 | 463 | |
452 | 464 | return $hits; |
453 | 465 | } |
@@ -575,9 +575,9 @@ discard block |
||
575 | 575 | $vocid = $request->getVocab()->getId(); |
576 | 576 | return $this->returnError('404', 'Not Found', "No download source URL known for vocabulary $vocid in language $dataLang"); |
577 | 577 | } |
578 | - } else { |
|
578 | + } else { |
|
579 | 579 | header("Location: " . $urls[$format]); |
580 | - } |
|
580 | + } |
|
581 | 581 | } |
582 | 582 | |
583 | 583 | private function returnDataResults($results, $format) { |
@@ -1120,9 +1120,9 @@ discard block |
||
1120 | 1120 | } |
1121 | 1121 | return $this->returnJson(array_merge_recursive($this->context, |
1122 | 1122 | array('@context' => array( '@language' => $request->getLang(), |
1123 | - 'prefLabel' => 'skos:prefLabel', |
|
1124 | - 'xsd' => 'http://www.w3.org/2001/XMLSchema#', |
|
1125 | - 'date' => array( '@id' => 'http://purl.org/dc/terms/date', '@type' => 'http://www.w3.org/2001/XMLSchema#dateTime') ) |
|
1123 | + 'prefLabel' => 'skos:prefLabel', |
|
1124 | + 'xsd' => 'http://www.w3.org/2001/XMLSchema#', |
|
1125 | + 'date' => array( '@id' => 'http://purl.org/dc/terms/date', '@type' => 'http://www.w3.org/2001/XMLSchema#dateTime') ) |
|
1126 | 1126 | ), |
1127 | 1127 | array('changeList' => $simpleChangeList))); |
1128 | 1128 |
@@ -40,8 +40,7 @@ |
||
40 | 40 | $ret[$name] = array(); |
41 | 41 | if ($raw) { |
42 | 42 | $ret[$name] = $files[$type]; |
43 | - } |
|
44 | - else { |
|
43 | + } else { |
|
45 | 44 | foreach ($files[$type] as $file) { |
46 | 45 | array_push($ret[$name], 'plugins/' . $name . '/' . $file); |
47 | 46 | } |
@@ -74,7 +74,9 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function getQueryParam($paramName) |
76 | 76 | { |
77 | - if (!isset($this->queryParams[$paramName])) return null; |
|
77 | + if (!isset($this->queryParams[$paramName])) { |
|
78 | + return null; |
|
79 | + } |
|
78 | 80 | $val = filter_var($this->queryParams[$paramName], FILTER_SANITIZE_STRING); |
79 | 81 | return ($val !== null ? str_replace('\\', '', $val) : null); |
80 | 82 | } |
@@ -91,7 +93,9 @@ discard block |
||
91 | 93 | |
92 | 94 | public function getQueryParamPOST($paramName) |
93 | 95 | { |
94 | - if (!isset($this->queryParamsPOST[$paramName])) return null; |
|
96 | + if (!isset($this->queryParamsPOST[$paramName])) { |
|
97 | + return null; |
|
98 | + } |
|
95 | 99 | return filter_var($this->queryParamsPOST[$paramName], FILTER_SANITIZE_STRING); |
96 | 100 | } |
97 | 101 | |
@@ -106,7 +110,9 @@ discard block |
||
106 | 110 | |
107 | 111 | public function getServerConstant($paramName) |
108 | 112 | { |
109 | - if (!isset($this->serverConstants[$paramName])) return null; |
|
113 | + if (!isset($this->serverConstants[$paramName])) { |
|
114 | + return null; |
|
115 | + } |
|
110 | 116 | return filter_var($this->serverConstants[$paramName], FILTER_SANITIZE_STRING); |
111 | 117 | } |
112 | 118 | |
@@ -239,9 +245,11 @@ discard block |
||
239 | 245 | */ |
240 | 246 | public function setVocab($vocabid) |
241 | 247 | { |
242 | - if (strpos($vocabid, ' ') !== false) // if there are multiple vocabularies just storing the string |
|
248 | + if (strpos($vocabid, ' ') !== false) { |
|
249 | + // if there are multiple vocabularies just storing the string |
|
243 | 250 | { |
244 | 251 | $this->setVocabids($vocabid); |
252 | + } |
|
245 | 253 | } else { |
246 | 254 | $this->vocab = $this->model->getVocabulary($vocabid); |
247 | 255 | } |
@@ -109,10 +109,12 @@ |
||
109 | 109 | */ |
110 | 110 | private function initializeNamespaces() { |
111 | 111 | foreach ($this->namespaces as $prefix => $fullUri) { |
112 | - if ($prefix != '' && EasyRdf\RdfNamespace::get($prefix) === null) // if not already defined |
|
112 | + if ($prefix != '' && EasyRdf\RdfNamespace::get($prefix) === null) { |
|
113 | + // if not already defined |
|
113 | 114 | { |
114 | 115 | EasyRdf\RdfNamespace::set($prefix, $fullUri); |
115 | 116 | } |
117 | + } |
|
116 | 118 | } |
117 | 119 | } |
118 | 120 |
@@ -55,8 +55,9 @@ |
||
55 | 55 | |
56 | 56 | // not found with selected language, try any language |
57 | 57 | $literal = $this->getResource()->getLiteral($property); |
58 | - if ($literal) |
|
59 | - return $literal->getValue(); |
|
58 | + if ($literal) { |
|
59 | + return $literal->getValue(); |
|
60 | + } |
|
60 | 61 | |
61 | 62 | return $default; |
62 | 63 | } |
@@ -7,12 +7,12 @@ |
||
7 | 7 | abstract class BaseConfig extends DataObject |
8 | 8 | { |
9 | 9 | |
10 | - /** |
|
11 | - * Returns a boolean value based on a literal value from the config.ttl configuration. |
|
12 | - * @param string $property the property to query |
|
13 | - * @param boolean $default the default value if the value is not set in configuration |
|
14 | - * @return boolean the boolean value for the given property, or the default value if not found |
|
15 | - */ |
|
10 | + /** |
|
11 | + * Returns a boolean value based on a literal value from the config.ttl configuration. |
|
12 | + * @param string $property the property to query |
|
13 | + * @param boolean $default the default value if the value is not set in configuration |
|
14 | + * @return boolean the boolean value for the given property, or the default value if not found |
|
15 | + */ |
|
16 | 16 | protected function getBoolean($property, $default = false) |
17 | 17 | { |
18 | 18 | $val = $this->getResource()->getLiteral($property); |
@@ -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 |
@@ -312,8 +312,7 @@ discard block |
||
312 | 312 | foreach ($res->propertyUris() as $prop) { |
313 | 313 | $this->addPropertyValues($res, $prop, $seen); |
314 | 314 | } |
315 | - } |
|
316 | - else { |
|
315 | + } else { |
|
317 | 316 | foreach ($props as $prop) { |
318 | 317 | if ($res->hasProperty($prop)) { |
319 | 318 | $this->addPropertyValues($res, $prop, $seen); |
@@ -678,7 +677,9 @@ discard block |
||
678 | 677 | $subPrefLabelProps = $this->graph->resourcesMatching('rdfs:subPropertyOf', $prefLabelProp); |
679 | 678 | foreach ($subPrefLabelProps as $subPrefLabelProp) { |
680 | 679 | // return the first available translation |
681 | - if ($subPrefLabelProp->label($lang)) return $subPrefLabelProp->label($lang); |
|
680 | + if ($subPrefLabelProp->label($lang)) { |
|
681 | + return $subPrefLabelProp->label($lang); |
|
682 | + } |
|
682 | 683 | } |
683 | 684 | return null; |
684 | 685 | } |
@@ -909,8 +910,7 @@ discard block |
||
909 | 910 | if (!in_array($vocabUriSpace, $context, true)) { |
910 | 911 | if (!isset($context[$vocabPrefix])) { |
911 | 912 | $context[$vocabPrefix] = $vocabUriSpace; |
912 | - } |
|
913 | - else if ($context[$vocabPrefix] !== $vocabUriSpace) { |
|
913 | + } else if ($context[$vocabPrefix] !== $vocabUriSpace) { |
|
914 | 914 | $i = 2; |
915 | 915 | while (isset($context[$vocabPrefix . $i]) && $context[$vocabPrefix . $i] !== $vocabUriSpace) { |
916 | 916 | $i += 1; |
@@ -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 | } |