Passed
Pull Request — main (#1779)
by Joeli
11:37 queued 06:02
created
src/model/Vocabulary.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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];
Please login to merge, or discard this patch.
src/model/ConceptPropertyValue.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
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
                     }
Please login to merge, or discard this patch.
src/model/VocabularyConfig.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/model/Concept.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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));
Please login to merge, or discard this patch.
src/model/GlobalConfig.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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();
Please login to merge, or discard this patch.
src/model/ConceptPropertyValueLiteral.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
src/model/Request.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
src/controller/WebController.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
         }
38 38
 
39 39
         // specify where to look for templates and cache
40
-        $loader = new \Twig\Loader\FilesystemLoader(__DIR__ . '/../view');
40
+        $loader = new \Twig\Loader\FilesystemLoader(__DIR__.'/../view');
41 41
         // initialize Twig environment
42
-        $this->twig = new \Twig\Environment($loader, array('cache' => $tmpDir,'auto_reload' => true));
42
+        $this->twig = new \Twig\Environment($loader, array('cache' => $tmpDir, 'auto_reload' => true));
43 43
         // used for setting the base href for the relative urls
44 44
         $this->twig->addGlobal("BaseHref", $this->getBaseHref());
45 45
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
         $this->twig->addExtension(new LinkUrlExtension($model));
54 54
 
55 55
         // register a Twig filter for generating strings from language codes with CLDR
56
-        $langFilter = new \Twig\TwigFilter('lang_name', function ($langcode, $lang) {
56
+        $langFilter = new \Twig\TwigFilter('lang_name', function($langcode, $lang) {
57 57
             return Language::getName($langcode, $lang);
58 58
         });
59 59
         $this->twig->addFilter($langFilter);
@@ -239,16 +239,16 @@  discard block
 block discarded – undo
239 239
 
240 240
     private function createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender)
241 241
     {
242
-        $headers = "MIME-Version: 1.0" . "\r\n";
243
-        $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";
242
+        $headers = "MIME-Version: 1.0"."\r\n";
243
+        $headers .= "Content-type: text/html; charset=UTF-8"."\r\n";
244 244
         if (!empty($toMail)) {
245
-            $headers .= "Cc: " . $this->model->getConfig()->getFeedbackAddress() . "\r\n";
245
+            $headers .= "Cc: ".$this->model->getConfig()->getFeedbackAddress()."\r\n";
246 246
         }
247 247
         if (!empty($fromEmail)) {
248 248
             $headers .= "Reply-To: $fromName <$fromEmail>\r\n";
249 249
         }
250 250
         $service = $this->model->getConfig()->getServiceName();
251
-        return $headers . "From: $fromName via $service <$sender>";
251
+        return $headers."From: $fromName via $service <$sender>";
252 252
     }
253 253
 
254 254
     /**
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
     public function sendFeedback($request, $message, $messageSubject, $fromName = null, $fromEmail = null, $fromVocab = null, $toMail = null)
263 263
     {
264 264
         $toAddress = ($toMail) ? $toMail : $this->model->getConfig()->getFeedbackAddress();
265
-        $messageSubject = "[" . $this->model->getConfig()->getServiceName() . "] " . $messageSubject;
265
+        $messageSubject = "[".$this->model->getConfig()->getServiceName()."] ".$messageSubject;
266 266
         if ($fromVocab !== null && $fromVocab !== '') {
267
-            $message = 'Feedback from vocab: ' . strtoupper($fromVocab) . "<br />" . $message;
267
+            $message = 'Feedback from vocab: '.strtoupper($fromVocab)."<br />".$message;
268 268
         }
269 269
         $envelopeSender = $this->model->getConfig()->getFeedbackEnvelopeSender();
270 270
         // determine the sender address of the message
@@ -283,10 +283,10 @@  discard block
 block discarded – undo
283 283
         $headers = $this->createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender);
284 284
         $params = empty($envelopeSender) ? '' : "-f $envelopeSender";
285 285
         // adding some information about the user for debugging purposes.
286
-        $message = $message . "<br /><br /> Debugging information:"
287
-            . "<br />Timestamp: " . date(DATE_RFC2822)
288
-            . "<br />User agent: " . $request->getServerConstant('HTTP_USER_AGENT')
289
-            . "<br />Referer: " . $request->getServerConstant('HTTP_REFERER');
286
+        $message = $message."<br /><br /> Debugging information:"
287
+            . "<br />Timestamp: ".date(DATE_RFC2822)
288
+            . "<br />User agent: ".$request->getServerConstant('HTTP_USER_AGENT')
289
+            . "<br />Referer: ".$request->getServerConstant('HTTP_REFERER');
290 290
 
291 291
         try {
292 292
             mail($toAddress, $messageSubject, $message, $headers, $params);
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
             header("HTTP/1.0 404 Not Found");
295 295
             $template = $this->twig->load('error.twig');
296 296
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
297
-                error_log('Caught exception: ' . $e->getMessage());
297
+                error_log('Caught exception: '.$e->getMessage());
298 298
             }
299 299
 
300 300
             echo $template->render(
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
                 } catch (ValueError $e) {
348 348
                     // fail fast with an error page if the vocabulary cannot be found
349 349
                     if ($this->model->getConfig()->getLogCaughtExceptions()) {
350
-                        error_log('Caught exception: ' . $e->getMessage());
350
+                        error_log('Caught exception: '.$e->getMessage());
351 351
                     }
352 352
                     header("HTTP/1.0 400 Bad Request");
353 353
                     $this->invokeGenericErrorPage($request, $e->getMessage());
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
             $errored = true;
370 370
             header("HTTP/1.0 500 Internal Server Error");
371 371
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
372
-                error_log('Caught exception: ' . $e->getMessage());
372
+                error_log('Caught exception: '.$e->getMessage());
373 373
             }
374 374
         }
375 375
         $vocabList = $this->model->getVocabularyList();
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
         } catch (Exception $e) {
410 410
             header("HTTP/1.0 500 Internal Server Error");
411 411
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
412
-                error_log('Caught exception: ' . $e->getMessage());
412
+                error_log('Caught exception: '.$e->getMessage());
413 413
             }
414 414
 
415 415
             echo $template->render(
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
         } catch (Exception $e) {
435 435
             header("HTTP/1.0 404 Not Found");
436 436
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
437
-                error_log('Caught exception: ' . $e->getMessage());
437
+                error_log('Caught exception: '.$e->getMessage());
438 438
             }
439 439
 
440 440
             echo $template->render(
Please login to merge, or discard this patch.
src/controller/EntityController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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);
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
             // guess vocabulary based on URI
59 59
             $vocab = $this->model->guessVocabularyFromURI($request->getUri());
60 60
             if ($vocab === null) {
61
-                return $this->returnError('404', 'Not Found', 'Unrecognized URI ' . $request->getUri());
61
+                return $this->returnError('404', 'Not Found', 'Unrecognized URI '.$request->getUri());
62 62
             }
63 63
             $request->setVocab($vocab->getId());
64 64
         }
Please login to merge, or discard this patch.