Completed
Push — master ( 858968...6eab88 )
by Henri
03:37
created
model/Request.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -167,9 +167,11 @@
 block discarded – undo
167 167
      */
168 168
     public function setVocab($vocabid)
169 169
     {
170
-        if (strpos($vocabid, ' ') !== false) // if there are multiple vocabularies just storing the string
170
+        if (strpos($vocabid, ' ') !== false) {
171
+          // if there are multiple vocabularies just storing the string
171 172
         {
172 173
             $this->setVocabids($vocabid);
174
+        }
173 175
         } else {
174 176
             $this->vocab = $this->model->getVocabulary($vocabid);
175 177
         }
Please login to merge, or discard this patch.
model/Vocabulary.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,10 +76,12 @@
 block discarded – undo
76 76
      */
77 77
     public function getUriSpace()
78 78
     {
79
-        if ($this->urispace === null) // initialize cache
79
+        if ($this->urispace === null) {
80
+          // initialize cache
80 81
         {
81 82
             $this->urispace = $this->resource->getLiteral('void:uriSpace')->getValue();
82 83
         }
84
+        }
83 85
 
84 86
         return $this->urispace;
85 87
     }
Please login to merge, or discard this patch.
model/DataObject.php 1 patch
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.
model/sparql/GenericSparql.php 1 patch
Braces   +10 added lines, -6 removed lines patch added patch discarded remove patch
@@ -46,12 +46,16 @@  discard block
 block discarded – undo
46 46
         $this->client = new EasyRdf\Sparql\Client($endpoint);
47 47
 
48 48
         // set graphClause so that it can be used by all queries
49
-        if ($this->isDefaultEndpoint()) // default endpoint; query any graph (and catch it in a variable)
49
+        if ($this->isDefaultEndpoint()) {
50
+          // default endpoint; query any graph (and catch it in a variable)
50 51
         {
51 52
             $this->graphClause = "GRAPH $graph";
52
-        } elseif ($graph) // query a specific graph
53
+        }
54
+        } elseif ($graph) {
55
+          // query a specific graph
53 56
         {
54 57
             $this->graphClause = "GRAPH <$graph>";
58
+        }
55 59
         } else // query the default graph
56 60
         {
57 61
             $this->graphClause = "";
@@ -100,8 +104,9 @@  discard block
 block discarded – undo
100 104
             }
101 105
         }
102 106
         foreach ($graphs as $graph) {
103
-            if($graph !== NULL)
104
-                $clause .= "FROM NAMED <$graph> "; 
107
+            if($graph !== NULL) {
108
+                            $clause .= "FROM NAMED <$graph> ";
109
+            }
105 110
         }
106 111
         return $clause;
107 112
     }
@@ -1847,8 +1852,7 @@  discard block
 block discarded – undo
1847 1852
         if (sizeof($ret) > 0) {
1848 1853
             // existing concept, with children
1849 1854
             return $ret;
1850
-        }
1851
-        else {
1855
+        } else {
1852 1856
             // nonexistent concept
1853 1857
             return null;
1854 1858
         }
Please login to merge, or discard this patch.
model/Model.php 1 patch
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -108,10 +108,12 @@  discard block
 block discarded – undo
108 108
     
109 109
     private function initializeNamespaces() {
110 110
         foreach ($this->namespaces as $prefix => $fullUri) {
111
-            if ($prefix != '' && EasyRdf\RdfNamespace::get($prefix) === null) // if not already defined
111
+            if ($prefix != '' && EasyRdf\RdfNamespace::get($prefix) === null) {
112
+              // if not already defined
112 113
             {
113 114
                 EasyRdf\RdfNamespace::set($prefix, $fullUri);
114 115
             }
116
+            }
115 117
         }
116 118
     }
117 119
     
@@ -425,10 +427,12 @@  discard block
 block discarded – undo
425 427
                 // register vocabulary ids as RDF namespace prefixes
426 428
                 $prefix = preg_replace('/\W+/', '', $voc->getId()); // strip non-word characters
427 429
                 try {
428
-                    if ($prefix != '' && EasyRdf\RdfNamespace::get($prefix) === null) // if not already defined
430
+                    if ($prefix != '' && EasyRdf\RdfNamespace::get($prefix) === null) {
431
+                      // if not already defined
429 432
                     {
430 433
                         EasyRdf\RdfNamespace::set($prefix, $voc->getUriSpace());
431 434
                     }
435
+                    }
432 436
 
433 437
                 } catch (Exception $e) {
434 438
                     // not valid as namespace identifier, ignore
@@ -551,8 +555,9 @@  discard block
 block discarded – undo
551 555
         
552 556
         // no preferred vocabulary, or it was not found, search in which vocabulary the concept has a label
553 557
         foreach ($vocabs as $vocab) {
554
-            if ($vocab->getConceptLabel($uri, null) !== null)
555
-                return $vocab;
558
+            if ($vocab->getConceptLabel($uri, null) !== null) {
559
+                            return $vocab;
560
+            }
556 561
         }
557 562
 
558 563
         // if the URI couldn't be found, fall back to the first vocabulary
Please login to merge, or discard this patch.
model/Cache.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,8 +25,7 @@
 block discarded – undo
25 25
     public function store($key, $value, $ttl=3600) {
26 26
         if (function_exists('apc_store')) {
27 27
             return apc_store($key, $value);
28
-        }
29
-        else if (function_exists('apcu_store')) {
28
+        } else if (function_exists('apcu_store')) {
30 29
             return apcu_store($key, $value, $ttl);
31 30
         }
32 31
     }
Please login to merge, or discard this patch.
model/VocabularyConfig.php 1 patch
Braces   +18 added lines, -9 removed lines patch added patch discarded remove patch
@@ -53,8 +53,9 @@  discard block
 block discarded – undo
53 53
 
54 54
         // not found with selected language, try any language
55 55
         $literal = $this->resource->getLiteral($property);
56
-        if ($literal)
57
-          return $literal->getValue();
56
+        if ($literal) {
57
+                  return $literal->getValue();
58
+        }
58 59
     }
59 60
 
60 61
     /**
@@ -95,8 +96,9 @@  discard block
 block discarded – undo
95 96
     public function getShortName()
96 97
     {
97 98
         $shortname = $this->getLiteral('skosmos:shortName');
98
-        if ($shortname)
99
-          return $shortname;
99
+        if ($shortname) {
100
+                  return $shortname;
101
+        }
100 102
 
101 103
         // if no shortname exists fall back to the id
102 104
         return $this->getId();
@@ -231,10 +233,12 @@  discard block
 block discarded – undo
231 233
         $ret = array();
232 234
         foreach ($resources as $res) {
233 235
             $prop = $res->getURI();
234
-            if (EasyRdf\RdfNamespace::shorten($prop) !== null) // shortening property labels if possible
236
+            if (EasyRdf\RdfNamespace::shorten($prop) !== null) {
237
+              // shortening property labels if possible
235 238
             {
236 239
                 $prop = EasyRdf\RdfNamespace::shorten($prop);
237 240
             }
241
+            }
238 242
 
239 243
             $ret[] = $prop;
240 244
         }
@@ -251,10 +255,12 @@  discard block
 block discarded – undo
251 255
         $resources = $this->resource->allResources("skosmos:hasMultiLingualProperty");
252 256
         foreach ($resources as $res) {
253 257
             $prop = $res->getURI();
254
-            if (EasyRdf\RdfNamespace::shorten($prop) !== null) // shortening property labels if possible
258
+            if (EasyRdf\RdfNamespace::shorten($prop) !== null) {
259
+              // shortening property labels if possible
255 260
             {
256 261
                 $prop = EasyRdf\RdfNamespace::shorten($prop);
257 262
             }
263
+            }
258 264
 
259 265
             if ($prop === $property) {
260 266
                 return true;
@@ -362,11 +368,12 @@  discard block
 block discarded – undo
362 368
     public function getId()
363 369
     {
364 370
         $uriparts = explode("#", $this->resource->getURI());
365
-        if (count($uriparts) != 1)
366
-        // hash namespace
371
+        if (count($uriparts) != 1) {
372
+                // hash namespace
367 373
         {
368 374
             return $uriparts[1];
369 375
         }
376
+        }
370 377
 
371 378
         // slash namespace
372 379
         $uriparts = explode("/", $this->resource->getURI());
@@ -394,10 +401,12 @@  discard block
 block discarded – undo
394 401
         $ret = array();
395 402
         foreach ($resources as $res) {
396 403
             $prop = $res->getURI();
397
-            if (EasyRdf\RdfNamespace::shorten($prop) !== null) // prefixing if possible
404
+            if (EasyRdf\RdfNamespace::shorten($prop) !== null) {
405
+              // prefixing if possible
398 406
             {
399 407
                 $prop = EasyRdf\RdfNamespace::shorten($prop);
400 408
             }
409
+            }
401 410
 
402 411
             $ret[] = $prop;
403 412
         }
Please login to merge, or discard this patch.
model/ConceptSearchParameters.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,8 +69,9 @@
 block discarded – undo
69 69
     public function getSearchTerm()
70 70
     {
71 71
         $term = $this->request->getQueryParamRaw('q') ? $this->request->getQueryParamRaw('q') : $this->request->getQueryParamRaw('query');
72
-        if (!$term && $this->rest)
73
-            $term = $this->request->getQueryParamRaw('label');
72
+        if (!$term && $this->rest) {
73
+                    $term = $this->request->getQueryParamRaw('label');
74
+        }
74 75
         $term = trim($term); // surrounding whitespace is not considered significant
75 76
         if ($this->rest) {
76 77
             return $term;
Please login to merge, or discard this patch.
controller/RestController.php 1 patch
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.