@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | // 1. Ensure characters with special meaning in Lucene are escaped |
| 42 | 42 | $lucenemap = array(); |
| 43 | 43 | foreach (str_split(self::LUCENE_ESCAPE_CHARS) as $char) { |
| 44 | - $lucenemap[$char] = '\\' . $char; // escape with a backslash |
|
| 44 | + $lucenemap[$char] = '\\'.$char; // escape with a backslash |
|
| 45 | 45 | } |
| 46 | 46 | $term = strtr($term, $lucenemap); |
| 47 | 47 | |
@@ -128,11 +128,11 @@ discard block |
||
| 128 | 128 | # make text query clause |
| 129 | 129 | $lcletter = mb_strtolower($letter, 'UTF-8'); // convert to lower case, UTF-8 safe |
| 130 | 130 | $langClause = $this->generateLangClause($lang); |
| 131 | - $textcondPref = $this->createTextQueryCondition($letter . '*', 'skos:prefLabel', $langClause); |
|
| 132 | - $textcondAlt = $this->createTextQueryCondition($letter . '*', 'skos:altLabel', $langClause); |
|
| 133 | - $orderbyclause = $this->formatOrderBy("LCASE(?match)", $lang) . " STR(?s) LCASE(STR(?qualifier))"; |
|
| 131 | + $textcondPref = $this->createTextQueryCondition($letter.'*', 'skos:prefLabel', $langClause); |
|
| 132 | + $textcondAlt = $this->createTextQueryCondition($letter.'*', 'skos:altLabel', $langClause); |
|
| 133 | + $orderbyclause = $this->formatOrderBy("LCASE(?match)", $lang)." STR(?s) LCASE(STR(?qualifier))"; |
|
| 134 | 134 | |
| 135 | - $qualifierClause = $qualifier ? "OPTIONAL { ?s <" . $qualifier->getURI() . "> ?qualifier }" : ""; |
|
| 135 | + $qualifierClause = $qualifier ? "OPTIONAL { ?s <".$qualifier->getURI()."> ?qualifier }" : ""; |
|
| 136 | 136 | |
| 137 | 137 | $filterDeprecated = ""; |
| 138 | 138 | if (!$showDeprecated) { |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | return $lname; |
| 105 | 105 | } |
| 106 | 106 | // already a full URI |
| 107 | - return $this->getUriSpace() . $lname; |
|
| 107 | + return $this->getUriSpace().$lname; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | $result = $sparql->queryConceptScheme($defaultcs); |
| 167 | 167 | } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
| 168 | 168 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
| 169 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 169 | + error_log('Caught exception: '.$e->getMessage()); |
|
| 170 | 170 | } |
| 171 | 171 | return null; |
| 172 | 172 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | foreach ($conceptscheme->allLiterals($prop, null) as $val) { |
| 200 | 200 | $prop = (substr($prop, 0, 5) == 'dc11:') ? str_replace('dc11:', 'dc:', $prop) : $prop; |
| 201 | 201 | if ($val->getValue() instanceof DateTime) { |
| 202 | - $val = Punic\Calendar::formatDate($val->getValue(), 'full', $lang) . ' ' . Punic\Calendar::format($val->getValue(), 'HH:mm:ss', $lang); |
|
| 202 | + $val = Punic\Calendar::formatDate($val->getValue(), 'full', $lang).' '.Punic\Calendar::format($val->getValue(), 'HH:mm:ss', $lang); |
|
| 203 | 203 | } |
| 204 | 204 | $ret[$prop][] = $val; |
| 205 | 205 | } |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | $conceptSchemes = $this->getSparql()->queryConceptSchemes($lang); |
| 257 | 257 | } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
| 258 | 258 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
| 259 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 259 | + error_log('Caught exception: '.$e->getMessage()); |
|
| 260 | 260 | } |
| 261 | 261 | } |
| 262 | 262 | return $conceptSchemes; |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | } |
| 328 | 328 | // don't know how to parse |
| 329 | 329 | $rev = $parts[2]; |
| 330 | - $datestr = $parts[3] . ' ' . $parts[4]; |
|
| 330 | + $datestr = $parts[3].' '.$parts[4]; |
|
| 331 | 331 | |
| 332 | 332 | return "$datestr (r$rev)"; |
| 333 | 333 | } |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | $conceptInfo = $sparql->queryConceptInfo([$uri], $this->config->getArrayClassURI(), array($this), $clang); |
| 458 | 458 | } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
| 459 | 459 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
| 460 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 460 | + error_log('Caught exception: '.$e->getMessage()); |
|
| 461 | 461 | } |
| 462 | 462 | } |
| 463 | 463 | return $conceptInfo[0]; |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | if ($this->resource->allLiterals('skos:prefLabel')) { |
| 61 | 61 | foreach ($this->resource->allLiterals('skos:prefLabel') as $label) { |
| 62 | 62 | // the label lang code is a subtag of the UI lang eg. en-GB - create a new literal with the main language |
| 63 | - if ($label !== null && strpos($label->getLang(), $fallback . '-') === 0) { |
|
| 63 | + if ($label !== null && strpos($label->getLang(), $fallback.'-') === 0) { |
|
| 64 | 64 | return EasyRdf\Literal::create($label, $fallback); |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -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; |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | // We need to check all the labels in case one of them matches a subtag of the current language |
| 147 | 147 | foreach ($this->resource->allLiterals('skos:prefLabel') as $label) { |
| 148 | 148 | // the label lang code is a subtag of the UI lang eg. en-GB - create a new literal with the main language |
| 149 | - if ($label !== null && strpos($label->getLang(), $fallback . '-') === 0) { |
|
| 149 | + if ($label !== null && strpos($label->getLang(), $fallback.'-') === 0) { |
|
| 150 | 150 | return EasyRdf\Literal::create($label, $fallback); |
| 151 | 151 | } |
| 152 | 152 | } |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | // catch external subjects that have $res as object |
| 282 | 282 | $extSubjects = $exGraph->resourcesMatching("schema:about", $res); |
| 283 | 283 | |
| 284 | - $propList = array_unique(array_merge( |
|
| 284 | + $propList = array_unique(array_merge( |
|
| 285 | 285 | $this->DEFAULT_EXT_PROPERTIES, |
| 286 | 286 | $this->getVocab()->getConfig()->getExtProperties(), |
| 287 | 287 | $this->getVocab()->getConfig()->getPluginRegister()->getExtProperties() |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | */ |
| 336 | 336 | private function addPropertyValues($res, $prop, &$seen) |
| 337 | 337 | { |
| 338 | - $resList = $res->allResources('<' . $prop . '>'); |
|
| 338 | + $resList = $res->allResources('<'.$prop.'>'); |
|
| 339 | 339 | |
| 340 | 340 | foreach ($resList as $res2) { |
| 341 | 341 | if ($res2->isBNode()) { |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | $this->addResourceReifications($res, $prop, $res2, $seen); |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | - $litList = $res->allLiterals('<' . $prop . '>'); |
|
| 348 | + $litList = $res->allLiterals('<'.$prop.'>'); |
|
| 349 | 349 | |
| 350 | 350 | foreach ($litList as $lit) { |
| 351 | 351 | $this->graph->addLiteral($res, $prop, $lit); |
@@ -734,14 +734,14 @@ discard block |
||
| 734 | 734 | |
| 735 | 735 | // making a human readable string from the timestamps |
| 736 | 736 | if ($created != '') { |
| 737 | - $ret = $this->model->getText('skosmos:created') . ' ' . (Punic\Calendar::formatDate($created, 'short', $this->getLang())); |
|
| 737 | + $ret = $this->model->getText('skosmos:created').' '.(Punic\Calendar::formatDate($created, 'short', $this->getLang())); |
|
| 738 | 738 | } |
| 739 | 739 | |
| 740 | 740 | if ($modified != '') { |
| 741 | 741 | if ($created != '') { |
| 742 | - $ret .= ', ' . $this->model->getText('skosmos:modified') . ' ' . (Punic\Calendar::formatDate($modified, 'short', $this->getLang())); |
|
| 742 | + $ret .= ', '.$this->model->getText('skosmos:modified').' '.(Punic\Calendar::formatDate($modified, 'short', $this->getLang())); |
|
| 743 | 743 | } else { |
| 744 | - $ret .= ' ' . ucfirst($this->model->getText('skosmos:modified')) . ' ' . (Punic\Calendar::formatDate($modified, 'short', $this->getLang())); |
|
| 744 | + $ret .= ' '.ucfirst($this->model->getText('skosmos:modified')).' '.(Punic\Calendar::formatDate($modified, 'short', $this->getLang())); |
|
| 745 | 745 | } |
| 746 | 746 | |
| 747 | 747 | } |
@@ -749,12 +749,12 @@ discard block |
||
| 749 | 749 | trigger_error($e->getMessage(), E_USER_WARNING); |
| 750 | 750 | $ret = ''; |
| 751 | 751 | if ($this->resource->get('dc:modified')) { |
| 752 | - $modified = (string) $this->resource->get('dc:modified'); |
|
| 753 | - $ret = $this->model->getText('skosmos:modified') . ' ' . $modified; |
|
| 752 | + $modified = (string)$this->resource->get('dc:modified'); |
|
| 753 | + $ret = $this->model->getText('skosmos:modified').' '.$modified; |
|
| 754 | 754 | } |
| 755 | 755 | if ($this->resource->get('dc:created')) { |
| 756 | - $created .= (string) $this->resource->get('dc:created'); |
|
| 757 | - $ret .= ' ' . $this->model->getText('skosmos:created') . ' ' . $created; |
|
| 756 | + $created .= (string)$this->resource->get('dc:created'); |
|
| 757 | + $ret .= ' '.$this->model->getText('skosmos:created').' '.$created; |
|
| 758 | 758 | } |
| 759 | 759 | } |
| 760 | 760 | return $ret; |
@@ -810,7 +810,7 @@ discard block |
||
| 810 | 810 | $arrayClassURI = $this->vocab !== null ? $this->vocab->getConfig()->getArrayClassURI() : null; |
| 811 | 811 | $arrayClass = $arrayClassURI !== null ? EasyRdf\RdfNamespace::shorten($arrayClassURI) : null; |
| 812 | 812 | $superGroups = $this->resource->all('isothes:superGroup'); |
| 813 | - $superGroupUris = array_map(function ($obj) { return $obj->getUri(); }, $superGroups); |
|
| 813 | + $superGroupUris = array_map(function($obj) { return $obj->getUri(); }, $superGroups); |
|
| 814 | 814 | foreach ($collections as $collection) { |
| 815 | 815 | if (in_array($arrayClass, $collection->types()) === $includeArrays) { |
| 816 | 816 | // not adding the memberOf if the reverse resource is already covered by isothes:superGroup see issue #433 |
@@ -876,7 +876,7 @@ discard block |
||
| 876 | 876 | foreach ($labels as $lit) { |
| 877 | 877 | // filtering away subsets of the current language eg. en vs en-GB |
| 878 | 878 | $langCode = strval($lit->getLang()); |
| 879 | - if ($langCode != $this->clang && strpos($langCode, $this->getLang() . '-') !== 0) { |
|
| 879 | + if ($langCode != $this->clang && strpos($langCode, $this->getLang().'-') !== 0) { |
|
| 880 | 880 | $ret[$langCode][$key][] = new ConceptPropertyValueLiteral($this->model, $this->vocab, $this->resource, $lit, $prop); |
| 881 | 881 | } |
| 882 | 882 | } |
@@ -965,10 +965,10 @@ discard block |
||
| 965 | 965 | $context[$vocabPrefix] = $vocabUriSpace; |
| 966 | 966 | } elseif ($context[$vocabPrefix] !== $vocabUriSpace) { |
| 967 | 967 | $i = 2; |
| 968 | - while (isset($context[$vocabPrefix . $i]) && $context[$vocabPrefix . $i] !== $vocabUriSpace) { |
|
| 968 | + while (isset($context[$vocabPrefix.$i]) && $context[$vocabPrefix.$i] !== $vocabUriSpace) { |
|
| 969 | 969 | $i += 1; |
| 970 | 970 | } |
| 971 | - $context[$vocabPrefix . $i] = $vocabUriSpace; |
|
| 971 | + $context[$vocabPrefix.$i] = $vocabUriSpace; |
|
| 972 | 972 | } |
| 973 | 973 | } |
| 974 | 974 | $compactJsonLD = \ML\JsonLD\JsonLD::compact($this->graph->serialise('jsonld'), json_encode($context)); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 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 |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | public function getGlobalPlugins() |
| 363 | 363 | { |
| 364 | 364 | $globalPlugins = array(); |
| 365 | - $globalPluginsResource = $this->getResource()->getResource("skosmos:globalPlugins"); |
|
| 365 | + $globalPluginsResource = $this->getResource()->getResource("skosmos:globalPlugins"); |
|
| 366 | 366 | if ($globalPluginsResource) { |
| 367 | 367 | foreach ($globalPluginsResource as $resource) { |
| 368 | 368 | $globalPlugins[] = $resource->getValue(); |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | return Punic\Calendar::formatDate($val, 'short'); |
| 45 | 45 | } catch (Exception $e) { |
| 46 | 46 | trigger_error($e->getMessage(), E_USER_WARNING); |
| 47 | - return (string) $this->literal; |
|
| 47 | + return (string)$this->literal; |
|
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | return $this->literal->getValue(); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function getDescription() |
| 81 | 81 | { |
| 82 | - $helpprop = $this->prop . "_help"; |
|
| 82 | + $helpprop = $this->prop."_help"; |
|
| 83 | 83 | |
| 84 | 84 | // see if we have a translation with the help text |
| 85 | 85 | $help = $this->model->getText($helpprop); |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | public function addValue($value) |
| 112 | 112 | { |
| 113 | - $this->values[ltrim($value->getNotation() . ' ') . $value->getLabel() . rtrim(' ' . $value->getUri())] = $value; |
|
| 113 | + $this->values[ltrim($value->getNotation().' ').$value->getLabel().rtrim(' '.$value->getUri())] = $value; |
|
| 114 | 114 | $this->is_sorted = false; |
| 115 | 115 | } |
| 116 | 116 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | # Note that getLabel() returns URIs in case of no label and may return a prefixed value which affects sorting |
| 121 | 121 | if (!empty($this->values)) { |
| 122 | 122 | if ($this->sort_by_notation) { |
| 123 | - uasort($this->values, function ($a, $b) { |
|
| 123 | + uasort($this->values, function($a, $b) { |
|
| 124 | 124 | $anot = $a->getNotation(); |
| 125 | 125 | $bnot = $b->getNotation(); |
| 126 | 126 | if ($anot == null) { |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | } |
| 142 | 142 | }); |
| 143 | 143 | } else { |
| 144 | - uasort($this->values, function ($a, $b) { |
|
| 144 | + uasort($this->values, function($a, $b) { |
|
| 145 | 145 | // assume that sort keys are unique |
| 146 | 146 | return strcoll($a->getSortKey(), $b->getSortKey()); |
| 147 | 147 | }); |
@@ -106,7 +106,7 @@ |
||
| 106 | 106 | |
| 107 | 107 | public function getRequestUri() |
| 108 | 108 | { |
| 109 | - return $this->getServerConstant('HTTP_HOST') . $this->getServerConstant('REQUEST_URI'); |
|
| 109 | + return $this->getServerConstant('HTTP_HOST').$this->getServerConstant('REQUEST_URI'); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |