Completed
Pull Request — master (#995)
by Osma
03:39 queued 01:47
created
model/ConceptMappingPropertyValue.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     {
37 37
         $label = $this->getLabel();
38 38
         $notation = $this->getNotation();
39
-        return ltrim($notation . ' ') . $label;
39
+        return ltrim($notation.' ').$label;
40 40
     }
41 41
 
42 42
     public function getType()
@@ -187,42 +187,42 @@  discard block
 block discarded – undo
187 187
             'from' => [
188 188
                 'memberSet' => [
189 189
                     [
190
-                        'uri' => (string) $this->source->getUri(),
190
+                        'uri' => (string)$this->source->getUri(),
191 191
                     ]
192 192
                 ]
193 193
             ],
194 194
             'to' => [
195 195
                 'memberSet' => [
196 196
                     [
197
-                        'uri' => (string) $this->getUri()
197
+                        'uri' => (string)$this->getUri()
198 198
                     ]
199 199
                 ]
200 200
             ],
201 201
             // EXTRA
202
-            'description' => gettext($this->type . "_help"), // pop-up text
202
+            'description' => gettext($this->type."_help"), // pop-up text
203 203
             'hrefLink' => $hrefLink, // link to resource as displayed in the UI
204 204
             'lang' => $propertyLang, // TBD: could it be part of the prefLabel?
205
-            'vocabName' => (string) $this->getVocabName(), // vocabulary as displayed in the UI
205
+            'vocabName' => (string)$this->getVocabName(), // vocabulary as displayed in the UI
206 206
             'typeLabel' => gettext($this->type), // a text used in the UI instead of, for example, skos:closeMatch
207 207
         ];
208 208
 
209 209
         $fromScheme = $this->vocab->getDefaultConceptScheme();
210 210
         if (isset($fromScheme)) {
211 211
             $ret['fromScheme'] = [
212
-                'uri' => (string) $fromScheme,
212
+                'uri' => (string)$fromScheme,
213 213
             ];
214 214
         }
215 215
 
216 216
         $exvocab = $this->getExvocab();
217 217
         if (isset($exvocab)) {
218 218
             $ret['toScheme'] = [
219
-                'uri' => (string) $exvocab->getDefaultConceptScheme(),
219
+                'uri' => (string)$exvocab->getDefaultConceptScheme(),
220 220
             ];
221 221
         }
222 222
 
223 223
         $notation = $this->getNotation();
224 224
         if (isset($notation)) {
225
-            $ret['to']['memberSet'][0]['notation'] = (string) $notation;
225
+            $ret['to']['memberSet'][0]['notation'] = (string)$notation;
226 226
         }
227 227
 
228 228
         $label = $this->getLabel($lang, $queryExVocabs);
Please login to merge, or discard this patch.
controller/WebController.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         // specify where to look for templates and cache
43 43
         $loader = new Twig_Loader_Filesystem('view');
44 44
         // initialize Twig environment
45
-        $this->twig = new Twig_Environment($loader, array('cache' => $tmpDir,'auto_reload' => true));
45
+        $this->twig = new Twig_Environment($loader, array('cache' => $tmpDir, 'auto_reload' => true));
46 46
         $this->twig->addExtension(new Twig_Extensions_Extension_I18n());
47 47
         // used for setting the base href for the relative urls
48 48
         $this->twig->addGlobal("BaseHref", $this->getBaseHref());
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
         $this->twig->addFilter(new Twig_SimpleFilter('link_url', array($this, 'linkUrlFilter')));
66 66
 
67 67
         // register a Twig filter for generating strings from language codes with CLDR
68
-        $langFilter = new Twig_SimpleFilter('lang_name', function ($langcode, $lang) {
68
+        $langFilter = new Twig_SimpleFilter('lang_name', function($langcode, $lang) {
69 69
             return Language::getName($langcode, $lang);
70 70
         });
71 71
         $this->twig->addFilter($langFilter);
@@ -363,17 +363,17 @@  discard block
 block discarded – undo
363 363
 
364 364
     private function createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender)
365 365
     {
366
-        $headers = "MIME-Version: 1.0" . "\r\n";
367
-        $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";
366
+        $headers = "MIME-Version: 1.0"."\r\n";
367
+        $headers .= "Content-type: text/html; charset=UTF-8"."\r\n";
368 368
         if (!empty($toMail)) {
369
-            $headers .= "Cc: " . $this->model->getConfig()->getFeedbackAddress() . "\r\n";
369
+            $headers .= "Cc: ".$this->model->getConfig()->getFeedbackAddress()."\r\n";
370 370
         }
371 371
         if (!empty($fromEmail)) {
372 372
             $headers .= "Reply-To: $fromName <$fromEmail>\r\n";
373 373
         }
374 374
 
375 375
         $service = $this->model->getConfig()->getServiceName();
376
-        return $headers . "From: $fromName via $service <$sender>";
376
+        return $headers."From: $fromName via $service <$sender>";
377 377
     }
378 378
 
379 379
     /**
@@ -387,11 +387,11 @@  discard block
 block discarded – undo
387 387
     {
388 388
         $toAddress = ($toMail) ? $toMail : $this->model->getConfig()->getFeedbackAddress();
389 389
         if ($fromVocab !== null && $fromVocab !== '') {
390
-            $message = 'Feedback from vocab: ' . strtoupper($fromVocab) . "<br />" . $message;
390
+            $message = 'Feedback from vocab: '.strtoupper($fromVocab)."<br />".$message;
391 391
         }
392 392
 
393 393
         $envelopeSender = $this->model->getConfig()->getFeedbackEnvelopeSender();
394
-        $subject = $this->model->getConfig()->getServiceName() . " feedback";
394
+        $subject = $this->model->getConfig()->getServiceName()." feedback";
395 395
         // determine the sender address of the message
396 396
         $sender = $this->model->getConfig()->getFeedbackSender();
397 397
         if (empty($sender)) $sender = $envelopeSender;
@@ -404,10 +404,10 @@  discard block
 block discarded – undo
404 404
         $params = empty($envelopeSender) ? '' : "-f $envelopeSender";
405 405
 
406 406
         // adding some information about the user for debugging purposes.
407
-        $message = $message . "<br /><br /> Debugging information:"
408
-            . "<br />Timestamp: " . date(DATE_RFC2822)
409
-            . "<br />User agent: " . $request->getServerConstant('HTTP_USER_AGENT')
410
-            . "<br />Referer: " . $request->getServerConstant('HTTP_REFERER');
407
+        $message = $message."<br /><br /> Debugging information:"
408
+            . "<br />Timestamp: ".date(DATE_RFC2822)
409
+            . "<br />User agent: ".$request->getServerConstant('HTTP_USER_AGENT')
410
+            . "<br />Referer: ".$request->getServerConstant('HTTP_REFERER');
411 411
 
412 412
         try {
413 413
             mail($toAddress, $subject, $message, $headers, $params);
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
             header("HTTP/1.0 404 Not Found");
416 416
             $template = $this->twig->loadTemplate('error-page.twig');
417 417
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
418
-                error_log('Caught exception: ' . $e->getMessage());
418
+                error_log('Caught exception: '.$e->getMessage());
419 419
             }
420 420
 
421 421
             echo $template->render(
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
         $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : null;
463 463
         $vocabObjects = array();
464 464
         if ($vocids) {
465
-            foreach($vocids as $vocid) {
465
+            foreach ($vocids as $vocid) {
466 466
                 $vocabObjects[] = $this->model->getVocabulary($vocid);
467 467
             }
468 468
         }
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
         } catch (Exception $e) {
474 474
             header("HTTP/1.0 404 Not Found");
475 475
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
476
-                error_log('Caught exception: ' . $e->getMessage());
476
+                error_log('Caught exception: '.$e->getMessage());
477 477
             }
478 478
             $this->invokeGenericErrorPage($request, $e->getMessage());
479 479
             return;
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
                 'search_count' => $counts,
490 490
                 'languages' => $this->languages,
491 491
                 'search_results' => $searchResults,
492
-                'rest' => $parameters->getOffset()>0,
492
+                'rest' => $parameters->getOffset() > 0,
493 493
                 'global_search' => true,
494 494
                 'term' => $request->getQueryParamRaw('q'),
495 495
                 'lang_list' => $langList,
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
         } catch (Exception $e) {
515 515
             header("HTTP/1.0 404 Not Found");
516 516
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
517
-                error_log('Caught exception: ' . $e->getMessage());
517
+                error_log('Caught exception: '.$e->getMessage());
518 518
             }
519 519
 
520 520
             echo $template->render(
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
         } catch (Exception $e) {
536 536
             header("HTTP/1.0 404 Not Found");
537 537
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
538
-                error_log('Caught exception: ' . $e->getMessage());
538
+                error_log('Caught exception: '.$e->getMessage());
539 539
             }
540 540
 
541 541
             echo $template->render(
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
                 'vocab' => $vocab,
553 553
                 'search_results' => $searchResults,
554 554
                 'search_count' => $counts,
555
-                'rest' => $parameters->getOffset()>0,
555
+                'rest' => $parameters->getOffset() > 0,
556 556
                 'limit_parent' => $parameters->getParentLimit(),
557 557
                 'limit_type' =>  $request->getQueryParam('type') ? explode('+', $request->getQueryParam('type')) : null,
558 558
                 'limit_group' => $parameters->getGroupLimit(),
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
      * Loads and renders the view containing a list of recent changes in the vocabulary.
682 682
      * @param Request $request
683 683
      */
684
-    public function invokeChangeList($request, $prop='dc:created')
684
+    public function invokeChangeList($request, $prop = 'dc:created')
685 685
     {
686 686
         // set language parameters for gettext
687 687
         $this->setLanguageProperties($request->getLang());
Please login to merge, or discard this patch.
model/sparql/GenericSparql.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
     protected function query($query) {
89 89
         $queryId = sprintf("%05d", rand(0, 99999));
90 90
         $logger = $this->model->getLogger();
91
-        $logger->info("[qid $queryId] SPARQL query:\n" . $this->generateQueryPrefixes($query) . "\n$query\n");
91
+        $logger->info("[qid $queryId] SPARQL query:\n".$this->generateQueryPrefixes($query)."\n$query\n");
92 92
         $starttime = microtime(true);
93 93
         $result = $this->client->query($query);
94 94
         $elapsed = intval(round((microtime(true) - $starttime) * 1000));
95
-        if(method_exists($result, 'numRows')) {
95
+        if (method_exists($result, 'numRows')) {
96 96
             $numRows = $result->numRows();
97 97
             $logger->info("[qid $queryId] result: $numRows rows returned in $elapsed ms");
98 98
         } else { // graph result
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      * @param Vocabulary[]|null $vocabs
109 109
      * @return string
110 110
      */
111
-    protected function generateFromClause($vocabs=null) {
111
+    protected function generateFromClause($vocabs = null) {
112 112
         $clause = '';
113 113
         if (!$vocabs) {
114 114
             return $this->graph !== '?graph' && $this->graph !== NULL ? "FROM <$this->graph>" : '';
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 
236 236
 	$quote_string = function($val) { return "'$val'"; };
237 237
 	$quoted_values = array_map($quote_string, $langs);
238
-	$langFilter = "FILTER(?lang IN (" . implode(',', $quoted_values) . "))";
238
+	$langFilter = "FILTER(?lang IN (".implode(',', $quoted_values)."))";
239 239
 
240 240
         $values = $this->formatValues('?type', $classes, 'uri');
241 241
         $valuesProp = $this->formatValues('?prop', $props, null);
@@ -661,9 +661,9 @@  discard block
 block discarded – undo
661 661
                 $conceptscheme['title'] = $row->title->getValue();
662 662
             }
663 663
             // add dct:subject and their labels in the result
664
-            if(isset($row->domain) && isset($row->domainLabel)){
665
-                $conceptscheme['subject']['uri']=$row->domain->getURI();
666
-                $conceptscheme['subject']['prefLabel']=$row->domainLabel->getValue();
664
+            if (isset($row->domain) && isset($row->domainLabel)) {
665
+                $conceptscheme['subject']['uri'] = $row->domain->getURI();
666
+                $conceptscheme['subject']['prefLabel'] = $row->domainLabel->getValue();
667 667
             }
668 668
 
669 669
             $ret[$row->cs->getURI()] = $conceptscheme;
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
           $values[] = "<$graph>";
731 731
         }
732 732
         if (count($values)) {
733
-          return "FILTER (?graph IN (" . implode(',', $values) . "))";
733
+          return "FILTER (?graph IN (".implode(',', $values)."))";
734 734
         }
735 735
     }
736 736
 
@@ -741,16 +741,16 @@  discard block
 block discarded – undo
741 741
      * @return string sparql query clauses
742 742
      */
743 743
     protected function formatLimitAndOffset($limit, $offset) {
744
-        $limit = ($limit) ? 'LIMIT ' . $limit : '';
745
-        $offset = ($offset) ? 'OFFSET ' . $offset : '';
744
+        $limit = ($limit) ? 'LIMIT '.$limit : '';
745
+        $offset = ($offset) ? 'OFFSET '.$offset : '';
746 746
         // eliminating whitespace and line changes when the conditions aren't needed.
747 747
         $limitandoffset = '';
748 748
         if ($limit && $offset) {
749
-            $limitandoffset = "\n" . $limit . "\n" . $offset;
749
+            $limitandoffset = "\n".$limit."\n".$offset;
750 750
         } elseif ($limit) {
751
-            $limitandoffset = "\n" . $limit;
751
+            $limitandoffset = "\n".$limit;
752 752
         } elseif ($offset) {
753
-            $limitandoffset = "\n" . $offset;
753
+            $limitandoffset = "\n".$offset;
754 754
         }
755 755
 
756 756
         return $limitandoffset;
@@ -902,14 +902,14 @@  discard block
 block discarded – undo
902 902
         // if search language and UI/display language differ, must also consider case where there is no prefLabel in
903 903
         // the display language; in that case, should use the label with the same language as the matched label
904 904
         $labelcondFallback = ($searchLang != $lang) ?
905
-          "OPTIONAL { # in case previous OPTIONAL block gives no labels\n" .
905
+          "OPTIONAL { # in case previous OPTIONAL block gives no labels\n".
906 906
           "?s skos:prefLabel ?label . FILTER (LANGMATCHES(LANG(?label), LANG(?match))) }" : "";
907 907
           
908 908
         //  Including the labels if there is no query term given.
909 909
         if ($rawterm === '') {
910 910
           $labelClause = "?s skos:prefLabel ?label .";
911
-          $labelClause = ($lang) ? $labelClause . " FILTER (LANGMATCHES(LANG(?label), '$lang'))" : $labelClause . "";
912
-          return $labelClause . " BIND(?label AS ?match)";
911
+          $labelClause = ($lang) ? $labelClause." FILTER (LANGMATCHES(LANG(?label), '$lang'))" : $labelClause."";
912
+          return $labelClause." BIND(?label AS ?match)";
913 913
         }
914 914
 
915 915
         /*
@@ -973,20 +973,20 @@  discard block
 block discarded – undo
973 973
         $schemecond = '';
974 974
         if (!empty($schemes)) {
975 975
             $conditions = array();
976
-            foreach($schemes as $scheme) {
976
+            foreach ($schemes as $scheme) {
977 977
                 $conditions[] = "{?s skos:inScheme <$scheme>}";
978 978
             }
979
-            $schemecond = '{'.implode(" UNION ",$conditions).'}';
979
+            $schemecond = '{'.implode(" UNION ", $conditions).'}';
980 980
         }
981
-        $filterDeprecated="";
981
+        $filterDeprecated = "";
982 982
         //show or hide deprecated concepts
983
-        if(!$showDeprecated){
984
-            $filterDeprecated="FILTER NOT EXISTS { ?s owl:deprecated true }";
983
+        if (!$showDeprecated) {
984
+            $filterDeprecated = "FILTER NOT EXISTS { ?s owl:deprecated true }";
985 985
         }
986 986
         // extra conditions for parent and group, if specified
987
-        $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <" . $params->getParentLimit() . "> ." : "";
988
-        $groupcond = ($params->getGroupLimit()) ? "<" . $params->getGroupLimit() . "> skos:member ?s ." : "";
989
-        $pgcond = $parentcond . $groupcond;
987
+        $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <".$params->getParentLimit()."> ." : "";
988
+        $groupcond = ($params->getGroupLimit()) ? "<".$params->getGroupLimit()."> skos:member ?s ." : "";
989
+        $pgcond = $parentcond.$groupcond;
990 990
 
991 991
         $orderextra = $this->isDefaultEndpoint() ? $this->graph : '';
992 992
 
@@ -1059,9 +1059,9 @@  discard block
 block discarded – undo
1059 1059
             $hit['type'][] = $this->shortenUri($typeuri);
1060 1060
         }
1061 1061
 
1062
-        if(!empty($fields)) {
1062
+        if (!empty($fields)) {
1063 1063
             foreach ($fields as $prop) {
1064
-                $propname = $prop . 's';
1064
+                $propname = $prop.'s';
1065 1065
                 if (isset($row->$propname)) {
1066 1066
                     foreach (explode("\n", $row->$propname->getValue()) as $line) {
1067 1067
                         $rdata = str_getcsv($line, ',', '"', '"');
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
                             $propvals = $rdata[2];
1077 1077
                         }
1078 1078
 
1079
-                        $hit['skos:' . $prop][] = $propvals;
1079
+                        $hit['skos:'.$prop][] = $propvals;
1080 1080
                     }
1081 1081
                 }
1082 1082
             }
@@ -1152,7 +1152,7 @@  discard block
 block discarded – undo
1152 1152
      * @return array query result object
1153 1153
      */
1154 1154
     public function queryConcepts($vocabs, $fields = null, $unique = false, $params, $showDeprecated = false) {
1155
-        $query = $this->generateConceptSearchQuery($fields, $unique, $params,$showDeprecated);
1155
+        $query = $this->generateConceptSearchQuery($fields, $unique, $params, $showDeprecated);
1156 1156
         $results = $this->query($query);
1157 1157
         return $this->transformConceptSearchResults($results, $vocabs, $fields);
1158 1158
     }
@@ -1207,10 +1207,10 @@  discard block
 block discarded – undo
1207 1207
         $conditions = $this->formatFilterConditions($letter, $lang);
1208 1208
         $filtercondLabel = $conditions['filterpref'];
1209 1209
         $filtercondALabel = $conditions['filteralt'];
1210
-        $qualifierClause = $qualifier ? "OPTIONAL { ?s <" . $qualifier->getURI() . "> ?qualifier }" : "";
1211
-        $filterDeprecated="";
1212
-        if(!$showDeprecated){
1213
-            $filterDeprecated="FILTER NOT EXISTS { ?s owl:deprecated true }";
1210
+        $qualifierClause = $qualifier ? "OPTIONAL { ?s <".$qualifier->getURI()."> ?qualifier }" : "";
1211
+        $filterDeprecated = "";
1212
+        if (!$showDeprecated) {
1213
+            $filterDeprecated = "FILTER NOT EXISTS { ?s owl:deprecated true }";
1214 1214
         }
1215 1215
         $query = <<<EOQ
1216 1216
 SELECT DISTINCT ?s ?label ?alabel ?qualifier $fcl
@@ -1632,7 +1632,7 @@  discard block
 block discarded – undo
1632 1632
                 if (!isset($row->label) || $row->label->getLang() === $lang) {
1633 1633
                     $ret[$row->object->getUri()] = $val;
1634 1634
                 } elseif ($row->label->getLang() === $fallbacklang) {
1635
-                    $val['label'] .= ' (' . $row->label->getLang() . ')';
1635
+                    $val['label'] .= ' ('.$row->label->getLang().')';
1636 1636
                     $ret[$row->object->getUri()] = $val;
1637 1637
                 }
1638 1638
             }
@@ -1728,10 +1728,10 @@  discard block
 block discarded – undo
1728 1728
 
1729 1729
             $label = null;
1730 1730
             if (isset($row->label)) {
1731
-                if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang . "-") == 0) {
1731
+                if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang."-") == 0) {
1732 1732
                     $label = $row->label->getValue();
1733 1733
                 } else {
1734
-                    $label = $row->label->getValue() . " (" . $row->label->getLang() . ")";
1734
+                    $label = $row->label->getValue()." (".$row->label->getLang().")";
1735 1735
                 }
1736 1736
 
1737 1737
             }
@@ -1807,8 +1807,8 @@  discard block
 block discarded – undo
1807 1807
         foreach ($result as $row) {
1808 1808
             if (isset($row->top) && isset($row->label)) {
1809 1809
                 $label = $row->label->getValue();
1810
-                if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang . "-") !== 0) {
1811
-                    $label .= ' (' . $row->label->getLang() . ')';
1810
+                if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang."-") !== 0) {
1811
+                    $label .= ' ('.$row->label->getLang().')';
1812 1812
                 }
1813 1813
                 $top = array('uri' => $row->top->getUri(), 'topConceptOf' => $row->topuri->getUri(), 'label' => $label, 'hasChildren' => filter_var($row->children->getValue(), FILTER_VALIDATE_BOOLEAN));
1814 1814
                 if (isset($row->notation)) {
@@ -1901,7 +1901,7 @@  discard block
 block discarded – undo
1901 1901
                 $ret[$uri]['exact'] = $row->exact->getUri();
1902 1902
             }
1903 1903
             if (isset($row->tops)) {
1904
-               $topConceptsList=explode(" ", $row->tops->getValue());
1904
+               $topConceptsList = explode(" ", $row->tops->getValue());
1905 1905
                // sort to garantee an alphabetical ordering of the URI
1906 1906
                sort($topConceptsList);
1907 1907
                $ret[$uri]['tops'] = $topConceptsList;
@@ -1914,8 +1914,8 @@  discard block
 block discarded – undo
1914 1914
                 $label = null;
1915 1915
                 if (isset($row->childlabel)) {
1916 1916
                     $label = $row->childlabel->getValue();
1917
-                    if ($row->childlabel->getLang() !== $lang && strpos($row->childlabel->getLang(), $lang . "-") !== 0) {
1918
-                        $label .= " (" . $row->childlabel->getLang() . ")";
1917
+                    if ($row->childlabel->getLang() !== $lang && strpos($row->childlabel->getLang(), $lang."-") !== 0) {
1918
+                        $label .= " (".$row->childlabel->getLang().")";
1919 1919
                     }
1920 1920
 
1921 1921
                 }
@@ -1936,8 +1936,8 @@  discard block
 block discarded – undo
1936 1936
             }
1937 1937
             if (isset($row->label)) {
1938 1938
                 $preflabel = $row->label->getValue();
1939
-                if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang . "-") !== 0) {
1940
-                    $preflabel .= ' (' . $row->label->getLang() . ')';
1939
+                if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang."-") !== 0) {
1940
+                    $preflabel .= ' ('.$row->label->getLang().')';
1941 1941
                 }
1942 1942
 
1943 1943
                 $ret[$uri]['prefLabel'] = $preflabel;
@@ -2058,9 +2058,9 @@  discard block
 block discarded – undo
2058 2058
      */
2059 2059
     private function generateConceptGroupContentsQuery($groupClass, $group, $lang, $showDeprecated = false) {
2060 2060
         $fcl = $this->generateFromClause();
2061
-        $filterDeprecated="";
2062
-        if(!$showDeprecated){
2063
-            $filterDeprecated="  FILTER NOT EXISTS { ?conc owl:deprecated true }";
2061
+        $filterDeprecated = "";
2062
+        if (!$showDeprecated) {
2063
+            $filterDeprecated = "  FILTER NOT EXISTS { ?conc owl:deprecated true }";
2064 2064
         }
2065 2065
         $query = <<<EOQ
2066 2066
 SELECT ?conc ?super ?label ?members ?type ?notation $fcl
@@ -2099,10 +2099,10 @@  discard block
 block discarded – undo
2099 2099
                     'type' => array($row->type->shorten()),
2100 2100
                 );
2101 2101
                 if (isset($row->label)) {
2102
-                    if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang . "-") == 0) {
2102
+                    if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang."-") == 0) {
2103 2103
                         $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue();
2104 2104
                     } else {
2105
-                        $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue() . " (" . $row->label->getLang() . ")";
2105
+                        $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue()." (".$row->label->getLang().")";
2106 2106
                     }
2107 2107
 
2108 2108
                 }
@@ -2130,8 +2130,8 @@  discard block
 block discarded – undo
2130 2130
      * @param boolean $showDeprecated whether to include deprecated concepts in search results
2131 2131
      * @return array Result array with concept URI as key and concept label as value
2132 2132
      */
2133
-    public function listConceptGroupContents($groupClass, $group, $lang,$showDeprecated = false) {
2134
-        $query = $this->generateConceptGroupContentsQuery($groupClass, $group, $lang,$showDeprecated);
2133
+    public function listConceptGroupContents($groupClass, $group, $lang, $showDeprecated = false) {
2134
+        $query = $this->generateConceptGroupContentsQuery($groupClass, $group, $lang, $showDeprecated);
2135 2135
         $result = $this->query($query);
2136 2136
         return $this->transformConceptGroupContentsResults($result, $lang);
2137 2137
     }
@@ -2144,7 +2144,7 @@  discard block
 block discarded – undo
2144 2144
      */
2145 2145
     private function generateChangeListQuery($lang, $offset, $prop) {
2146 2146
         $fcl = $this->generateFromClause();
2147
-        $offset = ($offset) ? 'OFFSET ' . $offset : '';
2147
+        $offset = ($offset) ? 'OFFSET '.$offset : '';
2148 2148
 
2149 2149
         $query = <<<EOQ
2150 2150
 SELECT DISTINCT ?concept ?date ?label $fcl
Please login to merge, or discard this patch.
model/sparql/JenaTextSparql.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
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
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      * @return string sparql order by clause
93 93
      */
94 94
     private function formatOrderBy($expression, $lang) {
95
-        if(!$this->model->getConfig()->getCollationEnabled()) {
95
+        if (!$this->model->getConfig()->getCollationEnabled()) {
96 96
             return $expression;
97 97
         }
98 98
         $orderby = sprintf('arq:collation(\'%2$s\', %1$s)', $expression, $lang);
@@ -126,15 +126,15 @@  discard block
 block discarded – undo
126 126
         # make text query clause
127 127
         $lcletter = mb_strtolower($letter, 'UTF-8'); // convert to lower case, UTF-8 safe
128 128
         $langClause = $this->generateLangClause($lang);
129
-        $textcondPref = $this->createTextQueryCondition($letter . '*', 'skos:prefLabel', $langClause);
130
-        $textcondAlt = $this->createTextQueryCondition($letter . '*', 'skos:altLabel', $langClause);
131
-        $orderbyclause = $this->formatOrderBy("LCASE(?match)", $lang) . " STR(?s) LCASE(STR(?qualifier))";
129
+        $textcondPref = $this->createTextQueryCondition($letter.'*', 'skos:prefLabel', $langClause);
130
+        $textcondAlt = $this->createTextQueryCondition($letter.'*', 'skos:altLabel', $langClause);
131
+        $orderbyclause = $this->formatOrderBy("LCASE(?match)", $lang)." STR(?s) LCASE(STR(?qualifier))";
132 132
 
133
-        $qualifierClause = $qualifier ? "OPTIONAL { ?s <" . $qualifier->getURI() . "> ?qualifier }" : "";
133
+        $qualifierClause = $qualifier ? "OPTIONAL { ?s <".$qualifier->getURI()."> ?qualifier }" : "";
134 134
 
135
-        $filterDeprecated="";
136
-        if(!$showDeprecated){
137
-            $filterDeprecated="FILTER NOT EXISTS { ?s owl:deprecated true }";
135
+        $filterDeprecated = "";
136
+        if (!$showDeprecated) {
137
+            $filterDeprecated = "FILTER NOT EXISTS { ?s owl:deprecated true }";
138 138
         }
139 139
 
140 140
         $query = <<<EOQ
Please login to merge, or discard this patch.
model/VocabularyConfig.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
     private $pluginParameters;
10 10
     private $languageOrderCache = array();
11 11
 
12
-    public function __construct($resource, $globalPlugins=array())
12
+    public function __construct($resource, $globalPlugins = array())
13 13
     {
14 14
         $this->resource = $resource;
15 15
         $plugins = $this->resource->allLiterals('skosmos:usePlugin');
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
                         $paramValue = $paramLiteral->getValue();
38 38
                         $paramLang = $paramLiteral->getLang();
39 39
                         if ($paramLang) {
40
-                            $paramName .= '_' . $paramLang;
40
+                            $paramName .= '_'.$paramLang;
41 41
                         }
42 42
                         $this->pluginParameters[$pluginName][$paramName] = $paramValue;
43 43
                     }
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         $langs = $this->getLanguages();
65 65
         $deflang = reset($langs); // picking the first one from the list with reset since the keys are not numeric
66 66
         if (sizeof($langs) > 1) {
67
-            trigger_error("Default language for vocabulary '" . $this->getShortName() . "' unknown, choosing '$deflang'.", E_USER_WARNING);
67
+            trigger_error("Default language for vocabulary '".$this->getShortName()."' unknown, choosing '$deflang'.", E_USER_WARNING);
68 68
         }
69 69
 
70 70
         return $deflang;
Please login to merge, or discard this patch.
controller/Controller.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -156,18 +156,18 @@  discard block
 block discarded – undo
156 156
         $localname = $vocab->getLocalName($uri);
157 157
         if ($localname !== $uri && $localname === urlencode($localname)) {
158 158
             // check that the prefix stripping worked, and there are no problematic chars in localname
159
-            $paramstr = count($params) > 0 ? '?' . http_build_query($params) : '';
159
+            $paramstr = count($params) > 0 ? '?'.http_build_query($params) : '';
160 160
             if ($type && $type !== '' && $type !== 'vocab' && !($localname === '' && $type === 'page')) {
161
-                return "$vocid/$lang/$type/$localname" . $paramstr;
161
+                return "$vocid/$lang/$type/$localname".$paramstr;
162 162
             }
163 163
 
164
-            return "$vocid/$lang/$localname" . $paramstr;
164
+            return "$vocid/$lang/$localname".$paramstr;
165 165
         }
166 166
 
167 167
         // case 2: URI outside vocabulary namespace, or has problematic chars
168 168
         // pass the full URI as parameter instead
169 169
         $params['uri'] = $uri;
170
-        return "$vocid/$lang/$type/?" . http_build_query($params);
170
+        return "$vocid/$lang/$type/?".http_build_query($params);
171 171
     }
172 172
 
173 173
     /**
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
     {
294 294
         if ($modifiedDate) {
295 295
             $ifModifiedSince = $this->getIfModifiedSince();
296
-            $this->sendHeader("Last-Modified: " . $modifiedDate->format('D, d M Y H:i:s \G\M\T'));
296
+            $this->sendHeader("Last-Modified: ".$modifiedDate->format('D, d M Y H:i:s \G\M\T'));
297 297
             if ($ifModifiedSince !== null && $ifModifiedSince >= $modifiedDate) {
298 298
                 $this->sendHeader("HTTP/1.0 304 Not Modified");
299 299
                 return true;
Please login to merge, or discard this patch.
model/Concept.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -137,9 +137,9 @@  discard block
 block discarded – undo
137 137
                 return $this->resource->label($fallback);
138 138
             }
139 139
             // We need to check all the labels in case one of them matches a subtag of the current language
140
-            foreach($this->resource->allLiterals('skos:prefLabel') as $label) {
140
+            foreach ($this->resource->allLiterals('skos:prefLabel') as $label) {
141 141
                 // the label lang code is a subtag of the UI lang eg. en-GB - create a new literal with the main language
142
-                if ($label !== null && strpos($label->getLang(), $fallback . '-') === 0) {
142
+                if ($label !== null && strpos($label->getLang(), $fallback.'-') === 0) {
143 143
                     return EasyRdf\Literal::create($label, $fallback);
144 144
                 }
145 145
             }
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 
161 161
     public function hasXlLabel($prop = 'prefLabel')
162 162
     {
163
-        if ($this->resource->hasProperty('skosxl:' . $prop)) {
163
+        if ($this->resource->hasProperty('skosxl:'.$prop)) {
164 164
             return true;
165 165
         }
166 166
         return false;
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     public function getXlLabel()
170 170
     {
171 171
         $labels = $this->resource->allResources('skosxl:prefLabel');
172
-        foreach($labels as $labres) {
172
+        foreach ($labels as $labres) {
173 173
             $label = $labres->getLiteral('skosxl:literalForm');
174 174
             if ($label !== null && $label->getLang() == $this->clang) {
175 175
                 return new LabelSkosXL($this->model, $labres);
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
         // catch external subjects that have $res as object
277 277
         $extSubjects = $exGraph->resourcesMatching("schema:about", $res);
278 278
 
279
-        $propList =  array_unique(array_merge(
279
+        $propList = array_unique(array_merge(
280 280
             $this->DEFAULT_EXT_PROPERTIES,
281 281
             $this->getVocab()->getConfig()->getExtProperties(),
282 282
             $this->getVocab()->getConfig()->getPlugins()->getExtProperties()
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
      * @param string[] $seen Processed resources so far
302 302
      * @param string[] $props (optional) limit to these property URIs
303 303
      */
304
-    private function addExternalTriplesToGraph($res, &$seen, $props=null)
304
+    private function addExternalTriplesToGraph($res, &$seen, $props = null)
305 305
     {
306 306
         if (array_key_exists($res->getUri(), $seen) && $seen[$res->getUri()] === 0) {
307 307
             return;
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
      */
332 332
     private function addPropertyValues($res, $prop, &$seen)
333 333
     {
334
-        $resList = $res->allResources('<' . $prop . '>');
334
+        $resList = $res->allResources('<'.$prop.'>');
335 335
 
336 336
         foreach ($resList as $res2) {
337 337
             if ($res2->isBNode()) {
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
             $this->addResourceReifications($res, $prop, $res2, $seen);
342 342
         }
343 343
 
344
-        $litList = $res->allLiterals('<' . $prop . '>');
344
+        $litList = $res->allLiterals('<'.$prop.'>');
345 345
 
346 346
         foreach ($litList as $lit) {
347 347
             $this->graph->addLiteral($res, $prop, $lit);
@@ -523,15 +523,15 @@  discard block
 block discarded – undo
523 523
                 // if not found in current vocabulary, look up in the default graph to be able
524 524
                 // to read an ontology loaded in a separate graph
525 525
                 // note that this imply that the property has an rdf:type declared for the query to work
526
-                if(!$is_well_known && !$proplabel) {
526
+                if (!$is_well_known && !$proplabel) {
527 527
                     $envLangLabels = $this->model->getDefaultSparql()->queryLabel($longUri, $this->getEnvLang());
528 528
                     
529 529
                     $defaultPropLabel = $this->model->getDefaultSparql()->queryLabel($longUri, '');
530 530
 
531
-					if($envLangLabels) {
531
+					if ($envLangLabels) {
532 532
 						$proplabel = $envLangLabels[$this->getEnvLang()];
533 533
                     } else {
534
-						if($defaultPropLabel) {
534
+						if ($defaultPropLabel) {
535 535
 							$proplabel = $defaultPropLabel[''];
536 536
 						}
537 537
 					}
@@ -544,12 +544,12 @@  discard block
 block discarded – undo
544 544
                 }
545 545
 
546 546
                 // also look up superprops in the default graph if not found in current vocabulary
547
-                if(!$is_well_known && (!$superprops || empty($superprops))) {
547
+                if (!$is_well_known && (!$superprops || empty($superprops))) {
548 548
                     $superprops = $this->model->getDefaultSparql()->querySuperProperties($longUri);
549 549
                 }
550 550
 
551 551
                 // we're reading only one super property, even if there are multiple ones
552
-                $superprop = ($superprops)?$superprops[0]:null;
552
+                $superprop = ($superprops) ? $superprops[0] : null;
553 553
                 if ($superprop) {
554 554
                     $superprop = EasyRdf\RdfNamespace::shorten($superprop) ? EasyRdf\RdfNamespace::shorten($superprop) : $superprop;
555 555
                 }
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
                 }
563 563
 
564 564
                 // searching for subproperties of literals too
565
-                if($superprops) {
565
+                if ($superprops) {
566 566
                     foreach ($superprops as $subi) {
567 567
                         $suburi = EasyRdf\RdfNamespace::shorten($subi) ? EasyRdf\RdfNamespace::shorten($subi) : $subi;
568 568
                         $duplicates[$suburi] = $prop;
@@ -708,14 +708,14 @@  discard block
 block discarded – undo
708 708
 
709 709
             // making a human readable string from the timestamps
710 710
             if ($created != '') {
711
-                $ret = gettext('skosmos:created') . ' ' . (Punic\Calendar::formatDate($created, 'short'));
711
+                $ret = gettext('skosmos:created').' '.(Punic\Calendar::formatDate($created, 'short'));
712 712
             }
713 713
 
714 714
             if ($modified != '') {
715 715
                 if ($created != '') {
716
-                    $ret .= ', ' . gettext('skosmos:modified') . ' ' . (Punic\Calendar::formatDate($modified, 'short'));
716
+                    $ret .= ', '.gettext('skosmos:modified').' '.(Punic\Calendar::formatDate($modified, 'short'));
717 717
                 } else {
718
-                    $ret .= ' ' . ucfirst(gettext('skosmos:modified')) . ' ' . (Punic\Calendar::formatDate($modified, 'short'));
718
+                    $ret .= ' '.ucfirst(gettext('skosmos:modified')).' '.(Punic\Calendar::formatDate($modified, 'short'));
719 719
                 }
720 720
 
721 721
             }
@@ -723,12 +723,12 @@  discard block
 block discarded – undo
723 723
             trigger_error($e->getMessage(), E_USER_WARNING);
724 724
             $ret = '';
725 725
             if ($this->resource->get('dc:modified')) {
726
-                $modified = (string) $this->resource->get('dc:modified');
727
-                $ret = gettext('skosmos:modified') . ' ' . $modified;
726
+                $modified = (string)$this->resource->get('dc:modified');
727
+                $ret = gettext('skosmos:modified').' '.$modified;
728 728
             }
729 729
             if ($this->resource->get('dc:created')) {
730
-                $created .= (string) $this->resource->get('dc:created');
731
-                $ret .= ' ' . gettext('skosmos:created') . ' ' . $created;
730
+                $created .= (string)$this->resource->get('dc:created');
731
+                $ret .= ' '.gettext('skosmos:created').' '.$created;
732 732
             }
733 733
         }
734 734
         return $ret;
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
                     $groups[$collLabel] = array($group);
801 801
 
802 802
                     $res = $collection;
803
-                    while($super = $this->graph->resourcesMatching('skos:member', $res)) {
803
+                    while ($super = $this->graph->resourcesMatching('skos:member', $res)) {
804 804
                         foreach ($super as $res) {
805 805
                             $superprop = new ConceptPropertyValue($this->model, $this->vocab, $res, 'skosmos:memberOfSuper', $this->clang);
806 806
                             array_unshift($groups[$collLabel], $superprop);
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
 
846 846
         foreach ($labels as $lit) {
847 847
             // filtering away subsets of the current language eg. en vs en-GB
848
-            if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang() . '-') !== 0) {
848
+            if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang().'-') !== 0) {
849 849
                 $langCode = $lit->getLang() ? $lit->getLang() : '';
850 850
                 $ret[$langCode][$key][] = new ConceptPropertyValueLiteral($this->model, $this->vocab, $this->resource, $lit, $prop);
851 851
             }
@@ -936,10 +936,10 @@  discard block
 block discarded – undo
936 936
             }
937 937
             else if ($context[$vocabPrefix] !== $vocabUriSpace) {
938 938
                 $i = 2;
939
-                while (isset($context[$vocabPrefix . $i]) && $context[$vocabPrefix . $i] !== $vocabUriSpace) {
939
+                while (isset($context[$vocabPrefix.$i]) && $context[$vocabPrefix.$i] !== $vocabUriSpace) {
940 940
                     $i += 1;
941 941
                 }
942
-                $context[$vocabPrefix . $i] = $vocabUriSpace;
942
+                $context[$vocabPrefix.$i] = $vocabUriSpace;
943 943
             }
944 944
         }
945 945
         $compactJsonLD = \ML\JsonLD\JsonLD::compact($this->graph->serialise('jsonld'), json_encode($context));
Please login to merge, or discard this patch.
model/ConceptProperty.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
      * @param string $prop property type eg. 'rdf:type'.
25 25
      * @param string $label
26 26
      */
27
-    public function __construct($prop, $label, $tooltip=null, $super=null, $sort_by_notation=false)
27
+    public function __construct($prop, $label, $tooltip = null, $super = null, $sort_by_notation = false)
28 28
     {
29 29
         $this->prop = $prop;
30 30
         $this->label = $label;
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      */
65 65
     public function getDescription()
66 66
     {
67
-        $helpprop = $this->prop . "_help";
67
+        $helpprop = $this->prop."_help";
68 68
 
69 69
         // see if we have a translation with the help text
70 70
         $help = gettext($helpprop);
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
     public function addValue($value)
97 97
     {
98
-        $this->values[ltrim($value->getNotation() . ' ') . $value->getLabel() . rtrim(' ' . $value->getUri())] = $value;
98
+        $this->values[ltrim($value->getNotation().' ').$value->getLabel().rtrim(' '.$value->getUri())] = $value;
99 99
         $this->is_sorted = false;
100 100
     }
101 101
 
Please login to merge, or discard this patch.