Passed
Push — fix-rest-callback-quotes-skosm... ( 68d90a )
by Osma
06:30
created
model/DataObject.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -79,10 +79,12 @@
 block discarded – undo
79 79
         if ($sortable !== null) {
80 80
             uksort($sortable, array($this, 'mycompare'));
81 81
             foreach ($sortable as $prop => $vals) {
82
-                if (is_array($prop)) // the ConceptProperty objects have their own sorting methods
82
+                if (is_array($prop)) {
83
+                  // the ConceptProperty objects have their own sorting methods
83 84
                 {
84 85
                     ksort($sortable[$prop]);
85 86
                 }
87
+                }
86 88
             }
87 89
         }
88 90
         return $sortable;
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -124,8 +124,8 @@
 block discarded – undo
124 124
      */
125 125
     public function getEnvLang()
126 126
     {
127
-       // get language from locale, same as used by gettext, set by Controller
128
-       return substr(getenv("LC_ALL"), 0, 2); // @codeCoverageIgnore
127
+        // get language from locale, same as used by gettext, set by Controller
128
+        return substr(getenv("LC_ALL"), 0, 2); // @codeCoverageIgnore
129 129
     }
130 130
 
131 131
     /**
Please login to merge, or discard this patch.
controller/RestController.php 2 patches
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -400,7 +400,9 @@  discard block
 block discarded – undo
400 400
                 $hits[] = $res;
401 401
             }
402 402
         }
403
-        if (sizeof($hits) > 0) return $hits;
403
+        if (sizeof($hits) > 0) {
404
+          return $hits;
405
+        }
404 406
 
405 407
         // case 2: case-insensitive match on preferred label
406 408
         foreach ($results as $res) {
@@ -408,7 +410,9 @@  discard block
 block discarded – undo
408 410
                 $hits[] = $res;
409 411
             }
410 412
         }
411
-        if (sizeof($hits) > 0) return $hits;
413
+        if (sizeof($hits) > 0) {
414
+          return $hits;
415
+        }
412 416
 
413 417
         if ($lang === null) {
414 418
             // case 1A: exact match on preferred label in any language
@@ -419,7 +423,9 @@  discard block
 block discarded – undo
419 423
                     $hits[] = $res;
420 424
                 }
421 425
             }
422
-            if (sizeof($hits) > 0) return $hits;
426
+            if (sizeof($hits) > 0) {
427
+              return $hits;
428
+            }
423 429
 
424 430
             // case 2A: case-insensitive match on preferred label in any language
425 431
             foreach ($results as $res) {
@@ -429,7 +435,9 @@  discard block
 block discarded – undo
429 435
                     $hits[] = $res;
430 436
                 }
431 437
             }
432
-            if (sizeof($hits) > 0) return $hits;
438
+            if (sizeof($hits) > 0) {
439
+              return $hits;
440
+            }
433 441
         }
434 442
 
435 443
         // case 3: exact match on alternate label
@@ -438,7 +446,9 @@  discard block
 block discarded – undo
438 446
                 $hits[] = $res;
439 447
             }
440 448
         }
441
-        if (sizeof($hits) > 0) return $hits;
449
+        if (sizeof($hits) > 0) {
450
+          return $hits;
451
+        }
442 452
 
443 453
 
444 454
         // case 4: case-insensitive match on alternate label
@@ -447,7 +457,9 @@  discard block
 block discarded – undo
447 457
                 $hits[] = $res;
448 458
             }
449 459
         }
450
-        if (sizeof($hits) > 0) return $hits;
460
+        if (sizeof($hits) > 0) {
461
+          return $hits;
462
+        }
451 463
 
452 464
         return $hits;
453 465
     }
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -575,9 +575,9 @@  discard block
 block discarded – undo
575 575
                 $vocid = $request->getVocab()->getId();
576 576
                 return $this->returnError('404', 'Not Found', "No download source URL known for vocabulary $vocid in language $dataLang");
577 577
             }
578
-		} else {
578
+    } else {
579 579
             header("Location: " . $urls[$format]);
580
-		}
580
+    }
581 581
     }
582 582
 
583 583
     private function returnDataResults($results, $format) {
@@ -1120,9 +1120,9 @@  discard block
 block discarded – undo
1120 1120
         }
1121 1121
         return $this->returnJson(array_merge_recursive($this->context,
1122 1122
                                                         array('@context' => array( '@language' => $request->getLang(),
1123
-                                                                                     'prefLabel' => 'skos:prefLabel',
1124
-                                                                                     'xsd' => 'http://www.w3.org/2001/XMLSchema#',
1125
-                                                                                     'date' => array( '@id' => 'http://purl.org/dc/terms/date', '@type' => 'http://www.w3.org/2001/XMLSchema#dateTime') )
1123
+                                                                                      'prefLabel' => 'skos:prefLabel',
1124
+                                                                                      'xsd' => 'http://www.w3.org/2001/XMLSchema#',
1125
+                                                                                      'date' => array( '@id' => 'http://purl.org/dc/terms/date', '@type' => 'http://www.w3.org/2001/XMLSchema#dateTime') )
1126 1126
                                                         ),
1127 1127
                                                         array('changeList' => $simpleChangeList)));
1128 1128
 
Please login to merge, or discard this patch.
model/PluginRegister.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,8 +40,7 @@
 block discarded – undo
40 40
                     $ret[$name] = array();
41 41
                     if ($raw) {
42 42
                         $ret[$name] = $files[$type];
43
-                    }
44
-                    else {
43
+                    } else {
45 44
                         foreach ($files[$type] as $file) {
46 45
                             array_push($ret[$name], 'plugins/' . $name . '/' . $file);
47 46
                         }
Please login to merge, or discard this patch.
model/GlobalConfig.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -109,10 +109,12 @@
 block discarded – undo
109 109
      */
110 110
     private function initializeNamespaces() {
111 111
         foreach ($this->namespaces as $prefix => $fullUri) {
112
-            if ($prefix != '' && EasyRdf\RdfNamespace::get($prefix) === null) // if not already defined
112
+            if ($prefix != '' && EasyRdf\RdfNamespace::get($prefix) === null) {
113
+              // if not already defined
113 114
             {
114 115
                 EasyRdf\RdfNamespace::set($prefix, $fullUri);
115 116
             }
117
+            }
116 118
         }
117 119
     }
118 120
 
Please login to merge, or discard this patch.
model/Concept.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -517,13 +517,13 @@
 block discarded – undo
517 517
                     
518 518
                     $defaultPropLabel = $this->model->getDefaultSparql()->queryLabel($longUri, '');
519 519
 
520
-					if($envLangLabels) {
521
-						$proplabel = $envLangLabels[$this->getEnvLang()];
520
+          if($envLangLabels) {
521
+            $proplabel = $envLangLabels[$this->getEnvLang()];
522 522
                     } else {
523
-						if($defaultPropLabel) {
524
-							$proplabel = $defaultPropLabel[''];
525
-						}
526
-					}
523
+            if($defaultPropLabel) {
524
+              $proplabel = $defaultPropLabel[''];
525
+            }
526
+          }
527 527
                 }
528 528
 
529 529
                 // look for superproperties in the current graph
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -312,8 +312,7 @@  discard block
 block discarded – undo
312 312
             foreach ($res->propertyUris() as $prop) {
313 313
                 $this->addPropertyValues($res, $prop, $seen);
314 314
             }
315
-        }
316
-        else {
315
+        } else {
317 316
             foreach ($props as $prop) {
318 317
                 if ($res->hasProperty($prop)) {
319 318
                     $this->addPropertyValues($res, $prop, $seen);
@@ -678,7 +677,9 @@  discard block
 block discarded – undo
678 677
         $subPrefLabelProps = $this->graph->resourcesMatching('rdfs:subPropertyOf', $prefLabelProp);
679 678
         foreach ($subPrefLabelProps as $subPrefLabelProp) {
680 679
             // return the first available translation
681
-            if ($subPrefLabelProp->label($lang)) return $subPrefLabelProp->label($lang);
680
+            if ($subPrefLabelProp->label($lang)) {
681
+              return $subPrefLabelProp->label($lang);
682
+            }
682 683
         }
683 684
         return null;
684 685
     }
@@ -909,8 +910,7 @@  discard block
 block discarded – undo
909 910
         if (!in_array($vocabUriSpace, $context, true)) {
910 911
             if (!isset($context[$vocabPrefix])) {
911 912
                 $context[$vocabPrefix] = $vocabUriSpace;
912
-            }
913
-            else if ($context[$vocabPrefix] !== $vocabUriSpace) {
913
+            } else if ($context[$vocabPrefix] !== $vocabUriSpace) {
914 914
                 $i = 2;
915 915
                 while (isset($context[$vocabPrefix . $i]) && $context[$vocabPrefix . $i] !== $vocabUriSpace) {
916 916
                     $i += 1;
Please login to merge, or discard this patch.
controller/EntityController.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,14 +30,14 @@
 block discarded – undo
30 30
             $url = $baseurl . "$vocid/";
31 31
         } else {
32 32
 
33
-   	        if ($localname !== $uri && $localname === urlencode($localname)) {
34
-   	        // the URI can be shortened
33
+              if ($localname !== $uri && $localname === urlencode($localname)) {
34
+              // the URI can be shortened
35 35
             $url = $baseurl . "$vocid/page/$localname";
36 36
             } else {
37 37
                 // must use full URI
38
-   	            $query = http_build_query(array('uri'=>$uri));
38
+                  $query = http_build_query(array('uri'=>$uri));
39 39
                 $url = $baseurl . "$vocid/page/?" . $query;
40
-	        }
40
+          }
41 41
         }
42 42
         $this->redirect303($url);
43 43
     }
Please login to merge, or discard this patch.
model/sparql/GenericSparql.php 2 patches
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -47,12 +47,16 @@  discard block
 block discarded – undo
47 47
         $this->client = new EasyRdf\Sparql\Client($endpoint);
48 48
 
49 49
         // set graphClause so that it can be used by all queries
50
-        if ($this->isDefaultEndpoint()) // default endpoint; query any graph (and catch it in a variable)
50
+        if ($this->isDefaultEndpoint()) {
51
+          // default endpoint; query any graph (and catch it in a variable)
51 52
         {
52 53
             $this->graphClause = "GRAPH $graph";
53
-        } elseif ($graph !== null) // query a specific graph
54
+        }
55
+        } elseif ($graph !== null) {
56
+          // query a specific graph
54 57
         {
55 58
             $this->graphClause = "GRAPH <$graph>";
59
+        }
56 60
         } else // query the default graph
57 61
         {
58 62
             $this->graphClause = "";
@@ -1274,8 +1278,7 @@  discard block
 block discarded – undo
1274 1278
             if (isset($row->qualifier)) {
1275 1279
                 if ($row->qualifier instanceof EasyRdf\Literal) {
1276 1280
                     $hit['qualifier'] = $row->qualifier->getValue();
1277
-                }
1278
-                else {
1281
+                } else {
1279 1282
                     $hit['qualifier'] = $row->qualifier->localName();
1280 1283
                 }
1281 1284
             }
@@ -1955,8 +1958,7 @@  discard block
 block discarded – undo
1955 1958
         if (sizeof($ret) > 0) {
1956 1959
             // existing concept, with children
1957 1960
             return $ret;
1958
-        }
1959
-        else {
1961
+        } else {
1960 1962
             // nonexistent concept
1961 1963
             return null;
1962 1964
         }
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      *
66 66
      * @param string $query
67 67
      * @return string
68
-    */
68
+     */
69 69
     protected function generateQueryPrefixes($query)
70 70
     {
71 71
         // Check for undefined prefixes
@@ -233,9 +233,9 @@  discard block
 block discarded – undo
233 233
         $gcl = $this->graphClause;
234 234
         $classes = ($classes) ? $classes : array('http://www.w3.org/2004/02/skos/core#Concept');
235 235
 
236
-	$quote_string = function($val) { return "'$val'"; };
237
-	$quoted_values = array_map($quote_string, $langs);
238
-	$langFilter = "FILTER(?lang IN (" . implode(',', $quoted_values) . "))";
236
+  $quote_string = function($val) { return "'$val'"; };
237
+  $quoted_values = array_map($quote_string, $langs);
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);
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
         return $query;
963 963
     }
964 964
     /**
965
-    *  This function can be overwritten in other SPARQL dialects for the possibility of handling the different language clauses
965
+     *  This function can be overwritten in other SPARQL dialects for the possibility of handling the different language clauses
966 966
      * @param string $lang
967 967
      * @return string formatted language clause
968 968
      */
@@ -1911,7 +1911,7 @@  discard block
 block discarded – undo
1911 1911
 
1912 1912
     /**
1913 1913
      * Generates a sparql query for finding the hierarchy for a concept.
1914
-	 * A concept may be a top concept in multiple schemes, returned as a single whitespace-separated literal.
1914
+     * A concept may be a top concept in multiple schemes, returned as a single whitespace-separated literal.
1915 1915
      * @param string $uri concept uri.
1916 1916
      * @param string $lang
1917 1917
      * @param string $fallback language to use if label is not available in the preferred language
@@ -1988,10 +1988,10 @@  discard block
 block discarded – undo
1988 1988
                 $ret[$uri]['exact'] = $row->exact->getUri();
1989 1989
             }
1990 1990
             if (isset($row->tops)) {
1991
-               $topConceptsList=explode(" ", $row->tops->getValue());
1992
-               // sort to guarantee an alphabetical ordering of the URI
1993
-               sort($topConceptsList);
1994
-               $ret[$uri]['tops'] = $topConceptsList;
1991
+                $topConceptsList=explode(" ", $row->tops->getValue());
1992
+                // sort to guarantee an alphabetical ordering of the URI
1993
+                sort($topConceptsList);
1994
+                $ret[$uri]['tops'] = $topConceptsList;
1995 1995
             }
1996 1996
             if (isset($row->children)) {
1997 1997
                 if (!isset($ret[$uri]['narrower'])) {
Please login to merge, or discard this patch.
model/ConceptProperty.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
             return $help;
73 73
         }
74 74
 
75
-       // if not, see if there was a comment/definition for the property in the graph
75
+        // if not, see if there was a comment/definition for the property in the graph
76 76
         if ($this->tooltip !== null) {
77 77
             return $this->tooltip;
78 78
         }
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -125,11 +125,9 @@  discard block
 block discarded – undo
125 125
                             return strcoll(strtolower($a->getLabel()), strtolower($b->getLabel()));
126 126
                         }
127 127
                         return 1;
128
-                    }
129
-                    else if ($bnot == null) {
128
+                    } else if ($bnot == null) {
130 129
                         return -1;
131
-                    }
132
-                    else {
130
+                    } else {
133 131
                         // assume that notations are unique, choose strategy
134 132
                         if ($this->sort_by_notation == "lexical") {
135 133
                             return strcoll($anot, $bnot);
@@ -138,8 +136,7 @@  discard block
 block discarded – undo
138 136
                         }
139 137
                     }
140 138
                 });
141
-            }
142
-            else {
139
+            } else {
143 140
                 uasort($this->values, function($a, $b) {
144 141
                     // assume that labels are unique
145 142
                     return strcoll(strtolower($a->getLabel()), strtolower($b->getLabel()));
Please login to merge, or discard this patch.
model/Model.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -354,10 +354,12 @@
 block discarded – undo
354 354
                 // register vocabulary ids as RDF namespace prefixes
355 355
                 $prefix = preg_replace('/\W+/', '', $voc->getId()); // strip non-word characters
356 356
                 try {
357
-                    if ($prefix != '' && EasyRdf\RdfNamespace::get($prefix) === null) // if not already defined
357
+                    if ($prefix != '' && EasyRdf\RdfNamespace::get($prefix) === null) {
358
+                      // if not already defined
358 359
                     {
359 360
                         EasyRdf\RdfNamespace::set($prefix, $voc->getUriSpace());
360 361
                     }
362
+                    }
361 363
 
362 364
                 } catch (Exception $e) {
363 365
                     // not valid as namespace identifier, ignore
Please login to merge, or discard this patch.