@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | /** |
30 | 30 | * Initializes the Model object |
31 | 31 | */ |
32 | - public function __construct(string $config_filename="../../config.ttl") |
|
32 | + public function __construct(string $config_filename = "../../config.ttl") |
|
33 | 33 | { |
34 | 34 | $this->resolver = new Resolver($this); |
35 | 35 | $this->globalConfig = new GlobalConfig($this, $config_filename); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $this->translator = new Translator($langcode); |
41 | 41 | } |
42 | 42 | $this->translator->addLoader('po', new PoFileLoader()); |
43 | - $this->translator->addResource('po', __DIR__.'/../../resource/translations/skosmos_' . $langcode . '.po', $langcode); |
|
43 | + $this->translator->addResource('po', __DIR__.'/../../resource/translations/skosmos_'.$langcode.'.po', $langcode); |
|
44 | 44 | } |
45 | 45 | $this->initializeLogging(); |
46 | 46 | } |
@@ -274,11 +274,11 @@ discard block |
||
274 | 274 | } |
275 | 275 | |
276 | 276 | $vocabs = $params->getVocabs(); |
277 | - $showDeprecated=false; |
|
277 | + $showDeprecated = false; |
|
278 | 278 | if (sizeof($vocabs) === 1) { // search within vocabulary |
279 | 279 | $voc = $vocabs[0]; |
280 | 280 | $sparql = $voc->getSparql(); |
281 | - $showDeprecated=$voc->getConfig()->getShowDeprecated(); |
|
281 | + $showDeprecated = $voc->getConfig()->getShowDeprecated(); |
|
282 | 282 | } else { // multi-vocabulary or global search |
283 | 283 | $voc = null; |
284 | 284 | $sparql = $this->getDefaultSparql(); |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | public function getVocabularyCategories() |
440 | 440 | { |
441 | 441 | $cats = $this->globalConfig->getGraph()->allOfType('skos:Concept'); |
442 | - if(empty($cats)) { |
|
442 | + if (empty($cats)) { |
|
443 | 443 | return array(new VocabularyCategory($this, null)); |
444 | 444 | } |
445 | 445 | |
@@ -520,9 +520,9 @@ discard block |
||
520 | 520 | } |
521 | 521 | |
522 | 522 | // if there are multiple vocabularies and one is the preferred vocabulary, return it |
523 | - if($preferredVocabId != null) { |
|
523 | + if ($preferredVocabId != null) { |
|
524 | 524 | foreach ($vocabs as $vocab) { |
525 | - if($vocab->getId() == $preferredVocabId) { |
|
525 | + if ($vocab->getId() == $preferredVocabId) { |
|
526 | 526 | try { |
527 | 527 | // double check that a label exists in the preferred vocabulary |
528 | 528 | if ($vocab->getConceptLabel($uri, null) !== null) { |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | } |
534 | 534 | } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
535 | 535 | if ($this->getConfig()->getLogCaughtExceptions()) { |
536 | - error_log('Caught exception: ' . $e->getMessage()); |
|
536 | + error_log('Caught exception: '.$e->getMessage()); |
|
537 | 537 | } |
538 | 538 | break; |
539 | 539 | } |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | } |
550 | 550 | } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
551 | 551 | if ($this->getConfig()->getLogCaughtExceptions()) { |
552 | - error_log('Caught exception: ' . $e->getMessage()); |
|
552 | + error_log('Caught exception: '.$e->getMessage()); |
|
553 | 553 | } |
554 | 554 | break; |
555 | 555 | } |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | // using apc cache for the resource if available |
623 | 623 | if ($this->globalConfig->getCache()->isAvailable()) { |
624 | 624 | // @codeCoverageIgnoreStart |
625 | - $key = 'fetch: ' . $uri; |
|
625 | + $key = 'fetch: '.$uri; |
|
626 | 626 | $resource = $this->globalConfig->getCache()->fetch($key); |
627 | 627 | if ($resource === null || $resource === false) { // was not found in cache, or previous request failed |
628 | 628 | $resource = $this->resolver->resolve($uri, $this->getConfig()->getHttpTimeout()); |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | */ |
644 | 644 | public function getSparqlImplementation($dialect, $endpoint, $graph) |
645 | 645 | { |
646 | - $classname = $dialect . "Sparql"; |
|
646 | + $classname = $dialect."Sparql"; |
|
647 | 647 | |
648 | 648 | return new $classname($endpoint, $graph, $this); |
649 | 649 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | } |
10 | 10 | require_once '../vendor/autoload.php'; |
11 | 11 | } catch (Exception $e) { |
12 | - echo "Error: " . $e->getMessage(); |
|
12 | + echo "Error: ".$e->getMessage(); |
|
13 | 13 | return; |
14 | 14 | } |
15 | 15 | |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | $model = new Model(); |
18 | 18 | } catch (Exception $e) { |
19 | 19 | header("HTTP/1.1 500 Internal Server Error"); |
20 | - echo "Error: " . $e->getMessage(); |
|
20 | + echo "Error: ".$e->getMessage(); |
|
21 | 21 | exit(1); |
22 | 22 | } |
23 | 23 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | // if language code missing, redirect to guessed language |
34 | 34 | // in any case, redirect to <lang>/ |
35 | 35 | $lang = sizeof($parts) == 2 && $parts[1] !== '' ? $parts[1] : $controller->guessLanguage($request); |
36 | - header("Location: " . $lang . "/"); |
|
36 | + header("Location: ".$lang."/"); |
|
37 | 37 | } else { |
38 | 38 | if (array_key_exists($parts[1], $model->getConfig()->getLanguages())) { // global pages |
39 | 39 | $request->setLang($parts[1]); |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | } |
64 | 64 | if (sizeof($parts) == 3) { // language code missing |
65 | 65 | $lang = $controller->guessLanguage($request); |
66 | - $newurl = $controller->getBaseHref() . $vocab . "/" . $lang . "/"; |
|
67 | - header("Location: " . $newurl); |
|
66 | + $newurl = $controller->getBaseHref().$vocab."/".$lang."/"; |
|
67 | + header("Location: ".$newurl); |
|
68 | 68 | } else { |
69 | 69 | if (array_key_exists($parts[2], $model->getConfig()->getLanguages())) { |
70 | 70 | $lang = $parts[2]; |
@@ -105,10 +105,10 @@ discard block |
||
105 | 105 | } |
106 | 106 | } else { // language code missing, redirect to some language version |
107 | 107 | $lang = $controller->guessLanguage($request, $vocab); |
108 | - $newurl = $controller->getBaseHref() . $vocab . "/" . $lang . "/" . implode('/', array_slice($parts, 2)); |
|
108 | + $newurl = $controller->getBaseHref().$vocab."/".$lang."/".implode('/', array_slice($parts, 2)); |
|
109 | 109 | $qs = $request->getServerConstant('QUERY_STRING'); |
110 | 110 | if ($qs) { |
111 | - $newurl .= "?" . $qs; |
|
111 | + $newurl .= "?".$qs; |
|
112 | 112 | } |
113 | 113 | header("Location: $newurl"); |
114 | 114 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | "skos:related", "skos:historyNote", "skosmos:memberOf", |
31 | 31 | "skosmos:memberOfArray"); |
32 | 32 | |
33 | - public function __construct(Model $model, EasyRdf\Resource $resource, array $globalPlugins=array()) |
|
33 | + public function __construct(Model $model, EasyRdf\Resource $resource, array $globalPlugins = array()) |
|
34 | 34 | { |
35 | 35 | parent::__construct($model, $resource); |
36 | 36 | $this->globalPlugins = $globalPlugins; |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $paramValue = $paramLiteral->getValue(); |
124 | 124 | $paramLang = $paramLiteral->getLang(); |
125 | 125 | if ($paramLang) { |
126 | - $paramName .= '_' . $paramLang; |
|
126 | + $paramName .= '_'.$paramLang; |
|
127 | 127 | } |
128 | 128 | $this->pluginParameters[$pluginName][$paramName] = $paramValue; |
129 | 129 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $labelProperty = $override->getResource('skosmos:property'); |
156 | 156 | $labelPropUri = $labelProperty->shorten(); |
157 | 157 | if (empty($this->labelOverrides[$labelPropUri])) { |
158 | - $this->labelOverrides[$labelPropUri] = array(); |
|
158 | + $this->labelOverrides[$labelPropUri] = array(); |
|
159 | 159 | } |
160 | 160 | $newOverrides = array(); |
161 | 161 | |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | $langs = $this->getLanguages(); |
230 | 230 | $deflang = reset($langs); // picking the first one from the list with reset since the keys are not numeric |
231 | 231 | if (sizeof($langs) > 1) { |
232 | - trigger_error("Default language for vocabulary '" . $this->getShortName() . "' unknown, choosing '$deflang'.", E_USER_WARNING); |
|
232 | + trigger_error("Default language for vocabulary '".$this->getShortName()."' unknown, choosing '$deflang'.", E_USER_WARNING); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | return $deflang; |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | */ |
31 | 31 | private $configModifiedTime = null; |
32 | 32 | |
33 | - public function __construct(Model $model, string $config_name='../../config.ttl') |
|
33 | + public function __construct(Model $model, string $config_name = '../../config.ttl') |
|
34 | 34 | { |
35 | 35 | $this->cache = new Cache(); |
36 | - $this->filePath = realpath(dirname(__FILE__) . "/" . $config_name); |
|
36 | + $this->filePath = realpath(dirname(__FILE__)."/".$config_name); |
|
37 | 37 | if (!file_exists($this->filePath)) { |
38 | 38 | throw new Exception('config.ttl file is missing, please provide one.'); |
39 | 39 | } |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | // use APC user cache to store parsed config.ttl configuration |
70 | 70 | if ($this->cache->isAvailable() && !is_null($this->configModifiedTime)) { |
71 | 71 | // @codeCoverageIgnoreStart |
72 | - $key = realpath($this->filePath) . ", " . $this->configModifiedTime; |
|
73 | - $nskey = "namespaces of " . $key; |
|
72 | + $key = realpath($this->filePath).", ".$this->configModifiedTime; |
|
73 | + $nskey = "namespaces of ".$key; |
|
74 | 74 | $this->graph = $this->cache->fetch($key); |
75 | 75 | $this->namespaces = $this->cache->fetch($nskey); |
76 | 76 | if ($this->graph === false || $this->namespaces === false) { // was not found in cache |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | public function getGlobalPlugins() |
320 | 320 | { |
321 | 321 | $globalPlugins = array(); |
322 | - $globalPluginsResource = $this->getResource()->getResource("skosmos:globalPlugins"); |
|
322 | + $globalPluginsResource = $this->getResource()->getResource("skosmos:globalPlugins"); |
|
323 | 323 | if ($globalPluginsResource) { |
324 | 324 | foreach ($globalPluginsResource as $resource) { |
325 | 325 | $globalPlugins[] = $resource->getValue(); |