Passed
Pull Request — master (#1477)
by
unknown
03:17
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()
@@ -180,25 +180,25 @@  discard block
 block discarded – undo
180 180
             'from' => [
181 181
                 'memberSet' => [
182 182
                     [
183
-                        'uri' => (string) $this->source->getUri(),
183
+                        'uri' => (string)$this->source->getUri(),
184 184
                     ]
185 185
                 ]
186 186
             ],
187 187
             'to' => [
188 188
                 'memberSet' => [
189 189
                     [
190
-                        'uri' => (string) $this->getUri()
190
+                        'uri' => (string)$this->getUri()
191 191
                     ]
192 192
                 ]
193 193
             ],
194 194
             // EXTRA
195 195
             'hrefLink' => $hrefLink, // link to resource as displayed in the UI
196 196
             'lang' => $propertyLang, // TBD: could it be part of the prefLabel?
197
-            'vocabName' => (string) $this->getVocabName(), // vocabulary as displayed in the UI
197
+            'vocabName' => (string)$this->getVocabName(), // vocabulary as displayed in the UI
198 198
             'typeLabel' => gettext($this->type), // a text used in the UI instead of, for example, skos:closeMatch
199 199
         ];
200 200
 
201
-        $helpprop = $this->type . "_help";
201
+        $helpprop = $this->type."_help";
202 202
         // see if we have a translation for the property help text
203 203
         $help = gettext($helpprop);
204 204
         if ($help != $helpprop) {
@@ -208,20 +208,20 @@  discard block
 block discarded – undo
208 208
         $fromScheme = $this->vocab->getDefaultConceptScheme();
209 209
         if (isset($fromScheme)) {
210 210
             $ret['fromScheme'] = [
211
-                'uri' => (string) $fromScheme,
211
+                'uri' => (string)$fromScheme,
212 212
             ];
213 213
         }
214 214
 
215 215
         $exvocab = $this->getExvocab();
216 216
         if (isset($exvocab)) {
217 217
             $ret['toScheme'] = [
218
-                'uri' => (string) $exvocab->getDefaultConceptScheme(),
218
+                'uri' => (string)$exvocab->getDefaultConceptScheme(),
219 219
             ];
220 220
         }
221 221
 
222 222
         $notation = $this->getNotation();
223 223
         if (isset($notation)) {
224
-            $ret['to']['memberSet'][0]['notation'] = (string) $notation;
224
+            $ret['to']['memberSet'][0]['notation'] = (string)$notation;
225 225
         }
226 226
 
227 227
         $label = $this->getLabel($lang, $queryExVocabs);
Please login to merge, or discard this patch.
controller/Honeypot.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
     {
33 33
         // Encrypt the current time
34 34
         $honey_time_encrypted = $this->getEncryptedTime();
35
-        return '<div id="' . $honey_name . '_wrap" style="display:none;">' . "\r\n" .
36
-               '<input name="' . $honey_name . '" type="text" value="" id="' . $honey_name . '"/>' . "\r\n" .
37
-               '<input name="' . $honey_time . '" type="text" value="' . $honey_time_encrypted . '"/>' . "\r\n" .
35
+        return '<div id="'.$honey_name.'_wrap" style="display:none;">'."\r\n".
36
+               '<input name="'.$honey_name.'" type="text" value="" id="'.$honey_name.'"/>'."\r\n".
37
+               '<input name="'.$honey_time.'" type="text" value="'.$honey_time_encrypted.'"/>'."\r\n".
38 38
                 '</div>';
39 39
     }
40 40
     /**
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         // Get the decrypted time
67 67
         $value = $this->decryptTime($value);
68 68
         // The current time should be greater than the time the form was built + minimum
69
-        return ( is_numeric($value) && time() > ($value + $minDelta) );
69
+        return (is_numeric($value) && time() > ($value + $minDelta));
70 70
     }
71 71
     /**
72 72
      * Get encrypted time
Please login to merge, or discard this patch.
model/BaseConfig.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
      * @param string $lang preferred language for the literal
45 45
      * @return string string value for the given property, or the default value if not found
46 46
      */
47
-    protected function getLiteral($property, $default=null, $lang=null)
47
+    protected function getLiteral($property, $default = null, $lang = null)
48 48
     {
49 49
         if (!isset($lang)) {
50 50
             $lang = $this->getEnvLang();
Please login to merge, or discard this patch.
controller/WebController.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         // specify where to look for templates and cache
38 38
         $loader = new Twig_Loader_Filesystem('view');
39 39
         // initialize Twig environment
40
-        $this->twig = new Twig_Environment($loader, array('cache' => $tmpDir,'auto_reload' => true));
40
+        $this->twig = new Twig_Environment($loader, array('cache' => $tmpDir, 'auto_reload' => true));
41 41
         $this->twig->addExtension(new Twig_Extensions_Extension_I18n());
42 42
         // used for setting the base href for the relative urls
43 43
         $this->twig->addGlobal("BaseHref", $this->getBaseHref());
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         $this->twig->addFilter(new Twig_SimpleFilter('link_url', array($this, 'linkUrlFilter')));
61 61
 
62 62
         // register a Twig filter for generating strings from language codes with CLDR
63
-        $langFilter = new Twig_SimpleFilter('lang_name', function ($langcode, $lang) {
63
+        $langFilter = new Twig_SimpleFilter('lang_name', function($langcode, $lang) {
64 64
             return Language::getName($langcode, $lang);
65 65
         });
66 66
         $this->twig->addFilter($langFilter);
@@ -234,16 +234,16 @@  discard block
 block discarded – undo
234 234
 
235 235
     private function createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender)
236 236
     {
237
-        $headers = "MIME-Version: 1.0" . "\r\n";
238
-        $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";
237
+        $headers = "MIME-Version: 1.0"."\r\n";
238
+        $headers .= "Content-type: text/html; charset=UTF-8"."\r\n";
239 239
         if (!empty($toMail)) {
240
-            $headers .= "Cc: " . $this->model->getConfig()->getFeedbackAddress() . "\r\n";
240
+            $headers .= "Cc: ".$this->model->getConfig()->getFeedbackAddress()."\r\n";
241 241
         }
242 242
         if (!empty($fromEmail)) {
243 243
             $headers .= "Reply-To: $fromName <$fromEmail>\r\n";
244 244
         }
245 245
         $service = $this->model->getConfig()->getServiceName();
246
-        return $headers . "From: $fromName via $service <$sender>";
246
+        return $headers."From: $fromName via $service <$sender>";
247 247
     }
248 248
 
249 249
     /**
@@ -257,9 +257,9 @@  discard block
 block discarded – undo
257 257
     public function sendFeedback($request, $message, $messageSubject, $fromName = null, $fromEmail = null, $fromVocab = null, $toMail = null)
258 258
     {
259 259
         $toAddress = ($toMail) ? $toMail : $this->model->getConfig()->getFeedbackAddress();
260
-        $messageSubject = "[" . $this->model->getConfig()->getServiceName() . "] " . $messageSubject;
260
+        $messageSubject = "[".$this->model->getConfig()->getServiceName()."] ".$messageSubject;
261 261
         if ($fromVocab !== null && $fromVocab !== '') {
262
-            $message = 'Feedback from vocab: ' . strtoupper($fromVocab) . "<br />" . $message;
262
+            $message = 'Feedback from vocab: '.strtoupper($fromVocab)."<br />".$message;
263 263
         }
264 264
         $envelopeSender = $this->model->getConfig()->getFeedbackEnvelopeSender();
265 265
         // determine the sender address of the message
@@ -272,10 +272,10 @@  discard block
 block discarded – undo
272 272
         $headers = $this->createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender);
273 273
         $params = empty($envelopeSender) ? '' : "-f $envelopeSender";
274 274
         // adding some information about the user for debugging purposes.
275
-        $message = $message . "<br /><br /> Debugging information:"
276
-            . "<br />Timestamp: " . date(DATE_RFC2822)
277
-            . "<br />User agent: " . $request->getServerConstant('HTTP_USER_AGENT')
278
-            . "<br />Referer: " . $request->getServerConstant('HTTP_REFERER');
275
+        $message = $message."<br /><br /> Debugging information:"
276
+            . "<br />Timestamp: ".date(DATE_RFC2822)
277
+            . "<br />User agent: ".$request->getServerConstant('HTTP_USER_AGENT')
278
+            . "<br />Referer: ".$request->getServerConstant('HTTP_REFERER');
279 279
 
280 280
         try {
281 281
             mail($toAddress, $messageSubject, $message, $headers, $params);
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
             header("HTTP/1.0 404 Not Found");
284 284
             $template = $this->twig->loadTemplate('error-page.twig');
285 285
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
286
-                error_log('Caught exception: ' . $e->getMessage());
286
+                error_log('Caught exception: '.$e->getMessage());
287 287
             }
288 288
 
289 289
             echo $template->render(
@@ -328,13 +328,13 @@  discard block
 block discarded – undo
328 328
         $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : null;
329 329
         $vocabObjects = array();
330 330
         if ($vocids) {
331
-            foreach($vocids as $vocid) {
331
+            foreach ($vocids as $vocid) {
332 332
                 try {
333 333
                     $vocabObjects[] = $this->model->getVocabulary($vocid);
334 334
                 } catch (ValueError $e) {
335 335
                     // fail fast with an error page if the vocabulary cannot be found
336 336
                     if ($this->model->getConfig()->getLogCaughtExceptions()) {
337
-                        error_log('Caught exception: ' . $e->getMessage());
337
+                        error_log('Caught exception: '.$e->getMessage());
338 338
                     }
339 339
                     header("HTTP/1.0 400 Bad Request");
340 340
                     $this->invokeGenericErrorPage($request, $e->getMessage());
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
             $errored = true;
357 357
             header("HTTP/1.0 500 Internal Server Error");
358 358
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
359
-                error_log('Caught exception: ' . $e->getMessage());
359
+                error_log('Caught exception: '.$e->getMessage());
360 360
             }
361 361
         }
362 362
         $vocabList = $this->model->getVocabularyList();
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
                 'search_count' => $counts,
369 369
                 'languages' => $this->languages,
370 370
                 'search_results' => $searchResults,
371
-                'rest' => $parameters->getOffset()>0,
371
+                'rest' => $parameters->getOffset() > 0,
372 372
                 'global_search' => true,
373 373
                 'search_failed' => $errored,
374 374
                 'term' => $request->getQueryParamRaw('q'),
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
         } catch (Exception $e) {
396 396
             header("HTTP/1.0 500 Internal Server Error");
397 397
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
398
-                error_log('Caught exception: ' . $e->getMessage());
398
+                error_log('Caught exception: '.$e->getMessage());
399 399
             }
400 400
 
401 401
             echo $template->render(
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
         } catch (Exception $e) {
420 420
             header("HTTP/1.0 404 Not Found");
421 421
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
422
-                error_log('Caught exception: ' . $e->getMessage());
422
+                error_log('Caught exception: '.$e->getMessage());
423 423
             }
424 424
 
425 425
             echo $template->render(
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
                 'vocab' => $vocab,
438 438
                 'search_results' => $searchResults,
439 439
                 'search_count' => $counts,
440
-                'rest' => $parameters->getOffset()>0,
440
+                'rest' => $parameters->getOffset() > 0,
441 441
                 'limit_parent' => $parameters->getParentLimit(),
442 442
                 'limit_type' =>  $request->getQueryParam('type') ? explode('+', $request->getQueryParam('type')) : null,
443 443
                 'limit_group' => $parameters->getGroupLimit(),
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
      * Loads and renders the view containing a list of recent changes in the vocabulary.
570 570
      * @param Request $request
571 571
      */
572
-    public function invokeChangeList($request, $prop='dc:created')
572
+    public function invokeChangeList($request, $prop = 'dc:created')
573 573
     {
574 574
         $offset = ($request->getQueryParam('offset') && is_numeric($request->getQueryParam('offset')) && $request->getQueryParam('offset') >= 0) ? $request->getQueryParam('offset') : 0;
575 575
         $limit = ($request->getQueryParam('limit') && is_numeric($request->getQueryParam('limit')) && $request->getQueryParam('limit') >= 0) ? $request->getQueryParam('limit') : 200;
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
      * @param int $limit maximum number of concepts to return
598 598
      * @return Array list of concepts
599 599
      */
600
-    public function getChangeList($request, $prop, $offset=0, $limit=200)
600
+    public function getChangeList($request, $prop, $offset = 0, $limit = 200)
601 601
     {
602 602
         // set language parameters for gettext
603 603
         $this->setLanguageProperties($request->getLang());
@@ -614,9 +614,9 @@  discard block
 block discarded – undo
614 614
     public function formatChangeList($changeList, $lang)
615 615
     {
616 616
         $formatByDate = array();
617
-        foreach($changeList as $concept) {
617
+        foreach ($changeList as $concept) {
618 618
             $concept['datestring'] = Punic\Calendar::formatDate($concept['date'], 'medium', $lang);
619
-            $formatByDate[Punic\Calendar::getMonthName($concept['date'], 'wide', $lang, true) . Punic\Calendar::format($concept['date'], ' y', $lang) ][strtolower($concept['prefLabel'])] = $concept;
619
+            $formatByDate[Punic\Calendar::getMonthName($concept['date'], 'wide', $lang, true).Punic\Calendar::format($concept['date'], ' y', $lang)][strtolower($concept['prefLabel'])] = $concept;
620 620
         }
621 621
         return $formatByDate;
622 622
     }
Please login to merge, or discard this patch.
model/Model.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -220,18 +220,18 @@  discard block
 block discarded – undo
220 220
         }
221 221
 
222 222
         $vocabs = $params->getVocabs();
223
-        $showDeprecated=false;
223
+        $showDeprecated = false;
224 224
         if (sizeof($vocabs) === 1) { // search within vocabulary
225 225
             $voc = $vocabs[0];
226 226
             $sparql = $voc->getSparql();
227
-            $showDeprecated=$voc->getConfig()->getShowDeprecated();
227
+            $showDeprecated = $voc->getConfig()->getShowDeprecated();
228 228
         } else { // multi-vocabulary or global search
229 229
             $voc = null;
230 230
             $sparql = $this->getDefaultSparql();
231 231
             // @TODO : in a global search showDeprecated will always be false and cannot be set globally
232 232
         }
233 233
 
234
-        $results = $sparql->queryConcepts($vocabs, $params->getAdditionalFields(), $params->getUnique(), $params,$showDeprecated);
234
+        $results = $sparql->queryConcepts($vocabs, $params->getAdditionalFields(), $params->getUnique(), $params, $showDeprecated);
235 235
         if ($params->getRest() && $results && $params->getSearchLimit() !== 0) {
236 236
           $results = array_slice($results, $params->getOffset(), $params->getSearchLimit());
237 237
         }
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
     public function getVocabularyCategories()
387 387
     {
388 388
         $cats = $this->globalConfig->getGraph()->allOfType('skos:Concept');
389
-        if(empty($cats)) {
389
+        if (empty($cats)) {
390 390
             return array(new VocabularyCategory($this, null));
391 391
         }
392 392
 
@@ -467,9 +467,9 @@  discard block
 block discarded – undo
467 467
         }
468 468
 
469 469
         // if there are multiple vocabularies and one is the preferred vocabulary, return it
470
-        if($preferredVocabId != null) {
470
+        if ($preferredVocabId != null) {
471 471
             foreach ($vocabs as $vocab) {
472
-                if($vocab->getId() == $preferredVocabId) {
472
+                if ($vocab->getId() == $preferredVocabId) {
473 473
                     try {
474 474
                         // double check that a label exists in the preferred vocabulary
475 475
                         if ($vocab->getConceptLabel($uri, null) !== null) {
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
                         }
481 481
                     } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) {
482 482
                         if ($this->getConfig()->getLogCaughtExceptions()) {
483
-                            error_log('Caught exception: ' . $e->getMessage());
483
+                            error_log('Caught exception: '.$e->getMessage());
484 484
                         }
485 485
                         break;
486 486
                     }
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
                 }
497 497
             } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) {
498 498
                 if ($this->getConfig()->getLogCaughtExceptions()) {
499
-                    error_log('Caught exception: ' . $e->getMessage());
499
+                    error_log('Caught exception: '.$e->getMessage());
500 500
                 }
501 501
                 break;
502 502
             }
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
         // using apc cache for the resource if available
567 567
         if ($this->globalConfig->getCache()->isAvailable()) {
568 568
             // @codeCoverageIgnoreStart
569
-            $key = 'fetch: ' . $uri;
569
+            $key = 'fetch: '.$uri;
570 570
             $resource = $this->globalConfig->getCache()->fetch($key);
571 571
             if ($resource === null || $resource === false) { // was not found in cache, or previous request failed
572 572
                 $resource = $this->resolver->resolve($uri, $this->getConfig()->getHttpTimeout());
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
      */
588 588
     public function getSparqlImplementation($dialect, $endpoint, $graph)
589 589
     {
590
-        $classname = $dialect . "Sparql";
590
+        $classname = $dialect."Sparql";
591 591
 
592 592
         return new $classname($endpoint, $graph, $this);
593 593
     }
Please login to merge, or discard this patch.
model/DataObject.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
                 return isset($results[$lang]) ? $results[$lang] : null;
53 53
             } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) {
54 54
                 if ($this->model->getConfig()->getLogCaughtExceptions()) {
55
-                    error_log('Caught exception: ' . $e->getMessage());
55
+                    error_log('Caught exception: '.$e->getMessage());
56 56
                 }
57 57
             }
58 58
         }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
                 return isset($results) ? $results : null;
75 75
             } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) {
76 76
                 if ($this->model->getConfig()->getLogCaughtExceptions()) {
77
-                    error_log('Caught exception: ' . $e->getMessage());
77
+                    error_log('Caught exception: '.$e->getMessage());
78 78
                 }
79 79
             }
80 80
         }
Please login to merge, or discard this patch.
model/Vocabulary.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
             return $lname;
103 103
         }
104 104
         // already a full URI
105
-        return $this->getUriSpace() . $lname;
105
+        return $this->getUriSpace().$lname;
106 106
     }
107 107
 
108 108
     /**
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
             $result = $sparql->queryConceptScheme($defaultcs);
165 165
         } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) {
166 166
              if ($this->model->getConfig()->getLogCaughtExceptions()) {
167
-                 error_log('Caught exception: ' . $e->getMessage());
167
+                 error_log('Caught exception: '.$e->getMessage());
168 168
              }
169 169
              return null;
170 170
         }
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
                 foreach ($conceptscheme->allLiterals($prop, null) as $val) {
198 198
                     $prop = (substr($prop, 0, 5) == 'dc11:') ? str_replace('dc11:', 'dc:', $prop) : $prop;
199 199
                     if ($val->getValue() instanceof DateTime) {
200
-                        $val = Punic\Calendar::formatDate($val->getValue(), 'full', $lang) . ' ' . Punic\Calendar::format($val->getValue(), 'HH:mm:ss', $lang);
200
+                        $val = Punic\Calendar::formatDate($val->getValue(), 'full', $lang).' '.Punic\Calendar::format($val->getValue(), 'HH:mm:ss', $lang);
201 201
                     }
202 202
                     $ret[$prop][] = $val;
203 203
                 }
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
             $conceptSchemes = $this->getSparql()->queryConceptSchemes($lang);
255 255
         } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) {
256 256
              if ($this->model->getConfig()->getLogCaughtExceptions()) {
257
-                 error_log('Caught exception: ' . $e->getMessage());
257
+                 error_log('Caught exception: '.$e->getMessage());
258 258
              }
259 259
         }
260 260
         return $conceptSchemes;
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
         }
326 326
         // don't know how to parse
327 327
         $rev = $parts[2];
328
-        $datestr = $parts[3] . ' ' . $parts[4];
328
+        $datestr = $parts[3].' '.$parts[4];
329 329
 
330 330
         return "$datestr (r$rev)";
331 331
     }
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
      * @param string $array the uri of the concept array class, eg. isothes:ThesaurusArray
337 337
      * @param string $group the uri of the  concept group class, eg. isothes:ConceptGroup
338 338
      */
339
-    public function getStatistics($lang = '', $array=null, $group=null)
339
+    public function getStatistics($lang = '', $array = null, $group = null)
340 340
     {
341 341
         $sparql = $this->getSparql();
342 342
         // find the number of concepts
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
             $conceptInfo = $sparql->queryConceptInfo($uri, $this->config->getArrayClassURI(), array($this), $clang);
455 455
         } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) {
456 456
              if ($this->model->getConfig()->getLogCaughtExceptions()) {
457
-                 error_log('Caught exception: ' . $e->getMessage());
457
+                 error_log('Caught exception: '.$e->getMessage());
458 458
              }
459 459
         }
460 460
         return $conceptInfo;
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
         return $this->getSparql()->queryChangeList($prop, $clang, $offset, $limit, $showDeprecated);
666 666
     }
667 667
 
668
-    public function getTitle($lang=null) {
668
+    public function getTitle($lang = null) {
669 669
       return $this->config->getTitle($lang);
670 670
     }
671 671
 
Please login to merge, or discard this patch.
model/VocabularyConfig.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     "skos:related", "skos:historyNote", "skosmos:memberOf",
30 30
     "skosmos:memberOfArray");
31 31
 
32
-    public function __construct($resource, $globalPlugins=array())
32
+    public function __construct($resource, $globalPlugins = array())
33 33
     {
34 34
         $this->resource = $resource;
35 35
         $this->globalPlugins = $globalPlugins;
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
                 $paramValue = $paramLiteral->getValue();
119 119
                 $paramLang = $paramLiteral->getLang();
120 120
                 if ($paramLang) {
121
-                    $paramName .= '_' . $paramLang;
121
+                    $paramName .= '_'.$paramLang;
122 122
                 }
123 123
                 $this->pluginParameters[$pluginName][$paramName] = $paramValue;
124 124
             }
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
         $labelProperty = $override->getResource('skosmos:property');
151 151
         $labelPropUri = $labelProperty->shorten();
152 152
         if (empty($this->labelOverrides[$labelPropUri])) {
153
-            $this->labelOverrides[$labelPropUri]  = array();
153
+            $this->labelOverrides[$labelPropUri] = array();
154 154
         }
155 155
         $newOverrides = array();
156 156
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
         $langs = $this->getLanguages();
225 225
         $deflang = reset($langs); // picking the first one from the list with reset since the keys are not numeric
226 226
         if (sizeof($langs) > 1) {
227
-            trigger_error("Default language for vocabulary '" . $this->getShortName() . "' unknown, choosing '$deflang'.", E_USER_WARNING);
227
+            trigger_error("Default language for vocabulary '".$this->getShortName()."' unknown, choosing '$deflang'.", E_USER_WARNING);
228 228
         }
229 229
 
230 230
         return $deflang;
Please login to merge, or discard this patch.
model/sparql/GenericSparql.php 1 patch
Spacing   +52 added lines, -52 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>" : '';
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 
250 250
 	$quote_string = function($val) { return "'$val'"; };
251 251
 	$quoted_values = array_map($quote_string, $langs);
252
-	$langFilter = "FILTER(?lang IN (" . implode(',', $quoted_values) . "))";
252
+	$langFilter = "FILTER(?lang IN (".implode(',', $quoted_values)."))";
253 253
 
254 254
         $values = $this->formatValues('?type', $classes, 'uri');
255 255
         $valuesProp = $this->formatValues('?prop', $props, null);
@@ -693,9 +693,9 @@  discard block
 block discarded – undo
693 693
                 $conceptscheme['title'] = $row->title->getValue();
694 694
             }
695 695
             // add dct:subject and their labels in the result
696
-            if(isset($row->domain) && isset($row->domainLabel)){
697
-                $conceptscheme['subject']['uri']=$row->domain->getURI();
698
-                $conceptscheme['subject']['prefLabel']=$row->domainLabel->getValue();
696
+            if (isset($row->domain) && isset($row->domainLabel)) {
697
+                $conceptscheme['subject']['uri'] = $row->domain->getURI();
698
+                $conceptscheme['subject']['prefLabel'] = $row->domainLabel->getValue();
699 699
             }
700 700
 
701 701
             $ret[$row->cs->getURI()] = $conceptscheme;
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
           $values[] = "<$graph>";
763 763
         }
764 764
         if (count($values)) {
765
-          return "FILTER (?graph IN (" . implode(',', $values) . "))";
765
+          return "FILTER (?graph IN (".implode(',', $values)."))";
766 766
         }
767 767
     }
768 768
 
@@ -773,16 +773,16 @@  discard block
 block discarded – undo
773 773
      * @return string sparql query clauses
774 774
      */
775 775
     protected function formatLimitAndOffset($limit, $offset) {
776
-        $limit = ($limit) ? 'LIMIT ' . $limit : '';
777
-        $offset = ($offset) ? 'OFFSET ' . $offset : '';
776
+        $limit = ($limit) ? 'LIMIT '.$limit : '';
777
+        $offset = ($offset) ? 'OFFSET '.$offset : '';
778 778
         // eliminating whitespace and line changes when the conditions aren't needed.
779 779
         $limitandoffset = '';
780 780
         if ($limit && $offset) {
781
-            $limitandoffset = "\n" . $limit . "\n" . $offset;
781
+            $limitandoffset = "\n".$limit."\n".$offset;
782 782
         } elseif ($limit) {
783
-            $limitandoffset = "\n" . $limit;
783
+            $limitandoffset = "\n".$limit;
784 784
         } elseif ($offset) {
785
-            $limitandoffset = "\n" . $offset;
785
+            $limitandoffset = "\n".$offset;
786 786
         }
787 787
 
788 788
         return $limitandoffset;
@@ -934,14 +934,14 @@  discard block
 block discarded – undo
934 934
         // if search language and UI/display language differ, must also consider case where there is no prefLabel in
935 935
         // the display language; in that case, should use the label with the same language as the matched label
936 936
         $labelcondFallback = ($searchLang != $lang) ?
937
-          "OPTIONAL { # in case previous OPTIONAL block gives no labels\n" .
937
+          "OPTIONAL { # in case previous OPTIONAL block gives no labels\n".
938 938
           "?s skos:prefLabel ?label . FILTER (LANGMATCHES(LANG(?label), LANG(?match))) }" : "";
939 939
 
940 940
         //  Including the labels if there is no query term given.
941 941
         if ($rawterm === '') {
942 942
           $labelClause = "?s skos:prefLabel ?label .";
943
-          $labelClause = ($lang) ? $labelClause . " FILTER (LANGMATCHES(LANG(?label), '$lang'))" : $labelClause . "";
944
-          return $labelClause . " BIND(?label AS ?match)";
943
+          $labelClause = ($lang) ? $labelClause." FILTER (LANGMATCHES(LANG(?label), '$lang'))" : $labelClause."";
944
+          return $labelClause." BIND(?label AS ?match)";
945 945
         }
946 946
 
947 947
         /*
@@ -1013,20 +1013,20 @@  discard block
 block discarded – undo
1013 1013
         $schemecond = '';
1014 1014
         if (!empty($schemes)) {
1015 1015
             $conditions = array();
1016
-            foreach($schemes as $scheme) {
1016
+            foreach ($schemes as $scheme) {
1017 1017
                 $conditions[] = "{?s skos:inScheme <$scheme>}";
1018 1018
             }
1019
-            $schemecond = '{'.implode(" UNION ",$conditions).'}';
1019
+            $schemecond = '{'.implode(" UNION ", $conditions).'}';
1020 1020
         }
1021
-        $filterDeprecated="";
1021
+        $filterDeprecated = "";
1022 1022
         //show or hide deprecated concepts
1023
-        if(!$showDeprecated){
1024
-            $filterDeprecated="FILTER NOT EXISTS { ?s owl:deprecated true }";
1023
+        if (!$showDeprecated) {
1024
+            $filterDeprecated = "FILTER NOT EXISTS { ?s owl:deprecated true }";
1025 1025
         }
1026 1026
         // extra conditions for parent and group, if specified
1027
-        $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <" . $params->getParentLimit() . "> ." : "";
1028
-        $groupcond = ($params->getGroupLimit()) ? "<" . $params->getGroupLimit() . "> skos:member ?s ." : "";
1029
-        $pgcond = $parentcond . $groupcond;
1027
+        $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <".$params->getParentLimit()."> ." : "";
1028
+        $groupcond = ($params->getGroupLimit()) ? "<".$params->getGroupLimit()."> skos:member ?s ." : "";
1029
+        $pgcond = $parentcond.$groupcond;
1030 1030
 
1031 1031
         $orderextra = $this->isDefaultEndpoint() ? $this->graph : '';
1032 1032
 
@@ -1112,9 +1112,9 @@  discard block
 block discarded – undo
1112 1112
             $hit['type'][] = $this->shortenUri($typeuri);
1113 1113
         }
1114 1114
 
1115
-        if(!empty($fields)) {
1115
+        if (!empty($fields)) {
1116 1116
             foreach ($fields as $prop) {
1117
-                $propname = $prop . 's';
1117
+                $propname = $prop.'s';
1118 1118
                 if (isset($row->$propname)) {
1119 1119
                     foreach (explode("\n", $row->$propname->getValue()) as $line) {
1120 1120
                         $rdata = str_getcsv($line, ',', '"', '"');
@@ -1129,7 +1129,7 @@  discard block
 block discarded – undo
1129 1129
                             $propvals = $rdata[2];
1130 1130
                         }
1131 1131
 
1132
-                        $hit['skos:' . $prop][] = $propvals;
1132
+                        $hit['skos:'.$prop][] = $propvals;
1133 1133
                     }
1134 1134
                 }
1135 1135
             }
@@ -1205,7 +1205,7 @@  discard block
 block discarded – undo
1205 1205
      * @return array query result object
1206 1206
      */
1207 1207
     public function queryConcepts($vocabs, $fields, $unique, $params, $showDeprecated = false) {
1208
-        $query = $this->generateConceptSearchQuery($fields, $unique, $params,$showDeprecated);
1208
+        $query = $this->generateConceptSearchQuery($fields, $unique, $params, $showDeprecated);
1209 1209
         $results = $this->query($query);
1210 1210
         return $this->transformConceptSearchResults($results, $vocabs, $fields);
1211 1211
     }
@@ -1260,10 +1260,10 @@  discard block
 block discarded – undo
1260 1260
         $conditions = $this->formatFilterConditions($letter, $lang);
1261 1261
         $filtercondLabel = $conditions['filterpref'];
1262 1262
         $filtercondALabel = $conditions['filteralt'];
1263
-        $qualifierClause = $qualifier ? "OPTIONAL { ?s <" . $qualifier->getURI() . "> ?qualifier }" : "";
1264
-        $filterDeprecated="";
1265
-        if(!$showDeprecated){
1266
-            $filterDeprecated="FILTER NOT EXISTS { ?s owl:deprecated true }";
1263
+        $qualifierClause = $qualifier ? "OPTIONAL { ?s <".$qualifier->getURI()."> ?qualifier }" : "";
1264
+        $filterDeprecated = "";
1265
+        if (!$showDeprecated) {
1266
+            $filterDeprecated = "FILTER NOT EXISTS { ?s owl:deprecated true }";
1267 1267
         }
1268 1268
         $query = <<<EOQ
1269 1269
 SELECT DISTINCT ?s ?label ?alabel ?qualifier
@@ -1740,7 +1740,7 @@  discard block
 block discarded – undo
1740 1740
                 if (!isset($row->label) || $row->label->getLang() === $lang) {
1741 1741
                     $ret[$row->object->getUri()] = $val;
1742 1742
                 } elseif ($row->label->getLang() === $fallbacklang) {
1743
-                    $val['label'] .= ' (' . $row->label->getLang() . ')';
1743
+                    $val['label'] .= ' ('.$row->label->getLang().')';
1744 1744
                     $ret[$row->object->getUri()] = $val;
1745 1745
                 }
1746 1746
             }
@@ -1836,10 +1836,10 @@  discard block
 block discarded – undo
1836 1836
 
1837 1837
             $label = null;
1838 1838
             if (isset($row->label)) {
1839
-                if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang . "-") == 0) {
1839
+                if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang."-") == 0) {
1840 1840
                     $label = $row->label->getValue();
1841 1841
                 } else {
1842
-                    $label = $row->label->getValue() . " (" . $row->label->getLang() . ")";
1842
+                    $label = $row->label->getValue()." (".$row->label->getLang().")";
1843 1843
                 }
1844 1844
 
1845 1845
             }
@@ -1915,8 +1915,8 @@  discard block
 block discarded – undo
1915 1915
         foreach ($result as $row) {
1916 1916
             if (isset($row->top) && isset($row->label)) {
1917 1917
                 $label = $row->label->getValue();
1918
-                if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang . "-") !== 0) {
1919
-                    $label .= ' (' . $row->label->getLang() . ')';
1918
+                if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang."-") !== 0) {
1919
+                    $label .= ' ('.$row->label->getLang().')';
1920 1920
                 }
1921 1921
                 $top = array('uri' => $row->top->getUri(), 'topConceptOf' => $row->topuri->getUri(), 'label' => $label, 'hasChildren' => filter_var($row->children->getValue(), FILTER_VALIDATE_BOOLEAN));
1922 1922
                 if (isset($row->notation)) {
@@ -2009,7 +2009,7 @@  discard block
 block discarded – undo
2009 2009
                 $ret[$uri]['exact'] = $row->exact->getUri();
2010 2010
             }
2011 2011
             if (isset($row->tops)) {
2012
-               $topConceptsList=explode(" ", $row->tops->getValue());
2012
+               $topConceptsList = explode(" ", $row->tops->getValue());
2013 2013
                // sort to guarantee an alphabetical ordering of the URI
2014 2014
                sort($topConceptsList);
2015 2015
                $ret[$uri]['tops'] = $topConceptsList;
@@ -2022,8 +2022,8 @@  discard block
 block discarded – undo
2022 2022
                 $label = null;
2023 2023
                 if (isset($row->childlabel)) {
2024 2024
                     $label = $row->childlabel->getValue();
2025
-                    if ($row->childlabel->getLang() !== $lang && strpos($row->childlabel->getLang(), $lang . "-") !== 0) {
2026
-                        $label .= " (" . $row->childlabel->getLang() . ")";
2025
+                    if ($row->childlabel->getLang() !== $lang && strpos($row->childlabel->getLang(), $lang."-") !== 0) {
2026
+                        $label .= " (".$row->childlabel->getLang().")";
2027 2027
                     }
2028 2028
 
2029 2029
                 }
@@ -2044,8 +2044,8 @@  discard block
 block discarded – undo
2044 2044
             }
2045 2045
             if (isset($row->label)) {
2046 2046
                 $preflabel = $row->label->getValue();
2047
-                if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang . "-") !== 0) {
2048
-                    $preflabel .= ' (' . $row->label->getLang() . ')';
2047
+                if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang."-") !== 0) {
2048
+                    $preflabel .= ' ('.$row->label->getLang().')';
2049 2049
                 }
2050 2050
 
2051 2051
                 $ret[$uri]['prefLabel'] = $preflabel;
@@ -2166,9 +2166,9 @@  discard block
 block discarded – undo
2166 2166
      */
2167 2167
     private function generateConceptGroupContentsQuery($groupClass, $group, $lang, $showDeprecated = false) {
2168 2168
         $fcl = $this->generateFromClause();
2169
-        $filterDeprecated="";
2170
-        if(!$showDeprecated){
2171
-            $filterDeprecated="  FILTER NOT EXISTS { ?conc owl:deprecated true }";
2169
+        $filterDeprecated = "";
2170
+        if (!$showDeprecated) {
2171
+            $filterDeprecated = "  FILTER NOT EXISTS { ?conc owl:deprecated true }";
2172 2172
         }
2173 2173
         $query = <<<EOQ
2174 2174
 SELECT ?conc ?super ?label ?members ?type ?notation $fcl
@@ -2207,10 +2207,10 @@  discard block
 block discarded – undo
2207 2207
                     'type' => array($row->type->shorten()),
2208 2208
                 );
2209 2209
                 if (isset($row->label)) {
2210
-                    if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang . "-") == 0) {
2210
+                    if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang."-") == 0) {
2211 2211
                         $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue();
2212 2212
                     } else {
2213
-                        $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue() . " (" . $row->label->getLang() . ")";
2213
+                        $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue()." (".$row->label->getLang().")";
2214 2214
                     }
2215 2215
 
2216 2216
                 }
@@ -2238,8 +2238,8 @@  discard block
 block discarded – undo
2238 2238
      * @param boolean $showDeprecated whether to include deprecated concepts in search results
2239 2239
      * @return array Result array with concept URI as key and concept label as value
2240 2240
      */
2241
-    public function listConceptGroupContents($groupClass, $group, $lang,$showDeprecated = false) {
2242
-        $query = $this->generateConceptGroupContentsQuery($groupClass, $group, $lang,$showDeprecated);
2241
+    public function listConceptGroupContents($groupClass, $group, $lang, $showDeprecated = false) {
2242
+        $query = $this->generateConceptGroupContentsQuery($groupClass, $group, $lang, $showDeprecated);
2243 2243
         $result = $this->query($query);
2244 2244
         return $this->transformConceptGroupContentsResults($result, $lang);
2245 2245
     }
@@ -2253,9 +2253,9 @@  discard block
 block discarded – undo
2253 2253
      * @param boolean $showDeprecated whether to include deprecated concepts in the change list
2254 2254
      * @return string sparql query
2255 2255
      */
2256
-    private function generateChangeListQuery($prop, $lang, $offset, $limit=200, $showDeprecated=false) {
2256
+    private function generateChangeListQuery($prop, $lang, $offset, $limit = 200, $showDeprecated = false) {
2257 2257
         $fcl = $this->generateFromClause();
2258
-        $offset = ($offset) ? 'OFFSET ' . $offset : '';
2258
+        $offset = ($offset) ? 'OFFSET '.$offset : '';
2259 2259
 
2260 2260
         //Additional clauses when deprecated concepts need to be included in the results
2261 2261
         $deprecatedOptions = '';
@@ -2333,7 +2333,7 @@  discard block
 block discarded – undo
2333 2333
      * @param boolean $showDeprecated whether to include deprecated concepts in the change list
2334 2334
      * @return array Result array
2335 2335
      */
2336
-    public function queryChangeList($prop, $lang, $offset, $limit, $showDeprecated=false) {
2336
+    public function queryChangeList($prop, $lang, $offset, $limit, $showDeprecated = false) {
2337 2337
         $query = $this->generateChangeListQuery($prop, $lang, $offset, $limit, $showDeprecated);
2338 2338
 
2339 2339
         $result = $this->query($query);
Please login to merge, or discard this patch.