Completed
Push — master ( 6d3987...c94882 )
by Henri
02:35
created
controller/WebController.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
         // register a Twig filter for generating URLs for vocabulary resources (concepts and groups)
71 71
         $controller = $this; // for use by anonymous function below
72
-        $urlFilter = new Twig_SimpleFilter('link_url', function ($uri, $vocab, $lang, $type = 'page', $clang = null, $term = null) use ($controller) {
72
+        $urlFilter = new Twig_SimpleFilter('link_url', function($uri, $vocab, $lang, $type = 'page', $clang = null, $term = null) use ($controller) {
73 73
             // $vocab can either be null, a vocabulary id (string) or a Vocabulary object
74 74
             if ($vocab === null) {
75 75
                 // target vocabulary is unknown, best bet is to link to the plain URI
@@ -94,23 +94,23 @@  discard block
 block discarded – undo
94 94
             $localname = $vocab->getLocalName($uri);
95 95
             if ($localname !== $uri && $localname === urlencode($localname)) {
96 96
                 // check that the prefix stripping worked, and there are no problematic chars in localname
97
-                $paramstr = sizeof($params) > 0 ? '?' . http_build_query($params) : '';
97
+                $paramstr = sizeof($params) > 0 ? '?'.http_build_query($params) : '';
98 98
                 if ($type && $type !== '' && $type !== 'vocab') {
99
-                    return "$vocid/$lang/$type/$localname" . $paramstr;
99
+                    return "$vocid/$lang/$type/$localname".$paramstr;
100 100
                 }
101 101
 
102
-                return "$vocid/$lang/$localname" . $paramstr;
102
+                return "$vocid/$lang/$localname".$paramstr;
103 103
             }
104 104
 
105 105
             // case 2: URI outside vocabulary namespace, or has problematic chars
106 106
             // pass the full URI as parameter instead
107 107
             $params['uri'] = $uri;
108
-            return "$vocid/$lang/$type/?" . http_build_query($params);
108
+            return "$vocid/$lang/$type/?".http_build_query($params);
109 109
         });
110 110
         $this->twig->addFilter($urlFilter);
111 111
 
112 112
         // register a Twig filter for generating strings from language codes with CLDR
113
-        $langFilter = new Twig_SimpleFilter('lang_name', function ($langcode, $lang) {
113
+        $langFilter = new Twig_SimpleFilter('lang_name', function($langcode, $lang) {
114 114
             return Language::getName($langcode, $lang);
115 115
         });
116 116
         $this->twig->addFilter($langFilter);
@@ -251,12 +251,12 @@  discard block
 block discarded – undo
251 251
     private function createFeedbackHeaders($fromName, $fromEmail, $toMail)
252 252
     {
253 253
         $headers = "MIME-Version: 1.0″ . '\r\n";
254
-        $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";
254
+        $headers .= "Content-type: text/html; charset=UTF-8"."\r\n";
255 255
         if ($toMail) {
256
-            $headers .= "Cc: " . $this->model->getConfig()->getFeedbackAddress() . "\r\n";
256
+            $headers .= "Cc: ".$this->model->getConfig()->getFeedbackAddress()."\r\n";
257 257
         }
258 258
 
259
-        $headers .= "From: $fromName <$fromEmail>" . "\r\n" . 'X-Mailer: PHP/' . phpversion();
259
+        $headers .= "From: $fromName <$fromEmail>"."\r\n".'X-Mailer: PHP/'.phpversion();
260 260
         return $headers;
261 261
     }
262 262
 
@@ -271,20 +271,20 @@  discard block
 block discarded – undo
271 271
     {
272 272
         $toAddress = ($toMail) ? $toMail : $this->model->getConfig()->getFeedbackAddress();
273 273
         if ($fromVocab !== null) {
274
-            $message = 'Feedback from vocab: ' . strtoupper($fromVocab) . "<br />" . $message;
274
+            $message = 'Feedback from vocab: '.strtoupper($fromVocab)."<br />".$message;
275 275
         }
276 276
 
277
-        $subject = SERVICE_NAME . " feedback";
277
+        $subject = SERVICE_NAME." feedback";
278 278
         $headers = $this->createFeedbackHeaders($fromName, $fromEmail, $toMail);
279 279
         $envelopeSender = FEEDBACK_ENVELOPE_SENDER;
280 280
         $params = empty($envelopeSender) ? '' : "-f $envelopeSender";
281 281
 
282 282
         // adding some information about the user for debugging purposes.
283
-        $message = $message . "<br /><br /> Debugging information:"
284
-            . "<br />Timestamp: " . date(DATE_RFC2822)
285
-            . "<br />User agent: " . $request->getServerConstant('HTTP_USER_AGENT')
286
-            . "<br />IP address: " . $request->getServerConstant('REMOTE_ADDR')
287
-            . "<br />Referer: " . $request->getServerConstant('HTTP_REFERER');
283
+        $message = $message."<br /><br /> Debugging information:"
284
+            . "<br />Timestamp: ".date(DATE_RFC2822)
285
+            . "<br />User agent: ".$request->getServerConstant('HTTP_USER_AGENT')
286
+            . "<br />IP address: ".$request->getServerConstant('REMOTE_ADDR')
287
+            . "<br />Referer: ".$request->getServerConstant('HTTP_REFERER');
288 288
 
289 289
         try {
290 290
             mail($toAddress, $subject, $message, $headers, $params);
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
             header("HTTP/1.0 404 Not Found");
293 293
             $template = $this->twig->loadTemplate('error-page.twig');
294 294
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
295
-                error_log('Caught exception: ' . $e->getMessage());
295
+                error_log('Caught exception: '.$e->getMessage());
296 296
             }
297 297
 
298 298
             echo $template->render(
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
         $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : null;
340 340
         $vocabObjects = array();
341 341
         if ($vocids) {
342
-            foreach($vocids as $vocid) {
342
+            foreach ($vocids as $vocid) {
343 343
                 $vocabObjects[] = $this->model->getVocabulary($vocid);
344 344
             }
345 345
         }
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
         } catch (Exception $e) {
351 351
             header("HTTP/1.0 404 Not Found");
352 352
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
353
-                error_log('Caught exception: ' . $e->getMessage());
353
+                error_log('Caught exception: '.$e->getMessage());
354 354
             }
355 355
             $this->invokeGenericErrorPage($request, $e->getMessage());
356 356
             return;
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
                 'search_count' => $counts,
367 367
                 'languages' => $this->languages,
368 368
                 'search_results' => $search_results,
369
-                'rest' => $parameters->getOffset()>0,
369
+                'rest' => $parameters->getOffset() > 0,
370 370
                 'global_search' => true,
371 371
                 'term' => $request->getQueryParam('q'),
372 372
                 'lang_list' => $langList,
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
         } catch (Exception $e) {
392 392
             header("HTTP/1.0 404 Not Found");
393 393
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
394
-                error_log('Caught exception: ' . $e->getMessage());
394
+                error_log('Caught exception: '.$e->getMessage());
395 395
             }
396 396
 
397 397
             echo $template->render(
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
         } catch (Exception $e) {
413 413
             header("HTTP/1.0 404 Not Found");
414 414
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
415
-                error_log('Caught exception: ' . $e->getMessage());
415
+                error_log('Caught exception: '.$e->getMessage());
416 416
             }
417 417
 
418 418
             echo $template->render(
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
                 'vocab' => $vocab,
430 430
                 'search_results' => $search_results,
431 431
                 'search_count' => $counts,
432
-                'rest' => $parameters->getOffset()>0,
432
+                'rest' => $parameters->getOffset() > 0,
433 433
                 'limit_parent' => $parameters->getParentLimit(),
434 434
                 'limit_type' =>  $request->getQueryParam('type') ? explode('+', $request->getQueryParam('type')) : null,
435 435
                 'limit_group' => $parameters->getGroupLimit(),
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
      * Loads and renders the view containing a list of recent changes in the vocabulary.
555 555
      * @param Request $request
556 556
      */
557
-    public function invokeChangeList($request, $prop='dc:created')
557
+    public function invokeChangeList($request, $prop = 'dc:created')
558 558
     {
559 559
         // set language parameters for gettext
560 560
         $this->setLanguageProperties($request->getLang());
Please login to merge, or discard this patch.
model/sparql/JenaTextSparql.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         // 1. Ensure characters with special meaning in Lucene are escaped
45 45
         $lucenemap = array();
46 46
         foreach (str_split(self::LUCENE_ESCAPE_CHARS) as $char) {
47
-            $lucenemap[$char] = '\\' . $char; // escape with a backslash
47
+            $lucenemap[$char] = '\\'.$char; // escape with a backslash
48 48
         }
49 49
         $term = strtr($term, $lucenemap);
50 50
 
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 
103 103
         # make text query clause
104 104
         $lcletter = mb_strtolower($letter, 'UTF-8'); // convert to lower case, UTF-8 safe
105
-        $textcondPref = $this->createTextQueryCondition($letter . '*', 'skos:prefLabel', $lang);
106
-        $textcondAlt = $this->createTextQueryCondition($letter . '*', 'skos:altLabel', $lang);
105
+        $textcondPref = $this->createTextQueryCondition($letter.'*', 'skos:prefLabel', $lang);
106
+        $textcondAlt = $this->createTextQueryCondition($letter.'*', 'skos:altLabel', $lang);
107 107
 
108 108
         $query = <<<EOQ
109 109
 SELECT DISTINCT ?s ?label ?alabel
Please login to merge, or discard this patch.
model/ConceptSearchParameters.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@
 block discarded – undo
81 81
         if ($this->rest) {
82 82
             return $term;
83 83
         }
84
-        return strpos($term, "*") === false ? $term . "*" : $term; // default to prefix search
84
+        return strpos($term, "*") === false ? $term."*" : $term; // default to prefix search
85 85
     }
86 86
     
87 87
     public function getContentLang() 
Please login to merge, or discard this patch.
entity.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,5 +23,5 @@
 block discarded – undo
23 23
 
24 24
 } catch (Exception $e) {
25 25
     header("HTTP/1.0 500 Internal Server Error");
26
-    echo('ERROR: ' . $e->getMessage());
26
+    echo('ERROR: '.$e->getMessage());
27 27
 }
Please login to merge, or discard this patch.
index.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
     }
15 15
     require_once 'vendor/autoload.php';
16 16
 } catch (Exception $e) {
17
-    echo "Error: " . $e->getMessage();
17
+    echo "Error: ".$e->getMessage();
18 18
     return;
19 19
 }
20 20
 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     // if language code missing, redirect to guessed language
33 33
     // in any case, redirect to <lang>/
34 34
     $lang = sizeof($parts) == 2 && $parts[1] !== '' ? $parts[1] : $controller->guessLanguage();
35
-    header("Location: " . $lang . "/");
35
+    header("Location: ".$lang."/");
36 36
 } else {
37 37
   if (array_key_exists($parts[1], $config->getLanguages())) { // global pages
38 38
         $request->setLang($parts[1]);
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
         }
62 62
         if (sizeof($parts) == 3) { // language code missing
63 63
             $lang = $controller->guessLanguage();
64
-            $newurl = $controller->getBaseHref() . $vocab . "/" . $lang . "/";
65
-            header("Location: " . $newurl);
64
+            $newurl = $controller->getBaseHref().$vocab."/".$lang."/";
65
+            header("Location: ".$newurl);
66 66
         } else {
67 67
             if (array_key_exists($parts[2], $config->getLanguages())) {
68 68
                 $lang = $parts[2];
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
                 }
104 104
             } else { // language code missing, redirect to some language version
105 105
                 $lang = $controller->guessLanguage($vocab);
106
-                $newurl = $controller->getBaseHref() . $vocab . "/" . $lang . "/" . implode('/', array_slice($parts, 2));
106
+                $newurl = $controller->getBaseHref().$vocab."/".$lang."/".implode('/', array_slice($parts, 2));
107 107
                 $qs = $request->getServerConstant('QUERY_STRING');
108 108
                 if ($qs) {
109
-                    $newurl .= "?" . $qs;
109
+                    $newurl .= "?".$qs;
110 110
                 }
111 111
                 header("Location: $newurl");
112 112
             }
Please login to merge, or discard this patch.
model/ConceptPropertyValue.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     {
25 25
         $label = is_string($this->getLabel()) ? $this->getLabel() : $this->getLabel()->getValue();
26 26
         if ($this->vocab->getConfig()->sortByNotation()) {
27
-            $label = $this->getNotation() . $label;
27
+            $label = $this->getNotation().$label;
28 28
         }
29 29
 
30 30
         return $label;
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
     public function getReifiedPropertyValues() {
121 121
         $ret = array();
122 122
         $props = $this->resource->properties();
123
-        foreach($props as $prop) {
123
+        foreach ($props as $prop) {
124 124
             if ($prop !== 'rdf:value') { // shown elsewhere
125 125
                 $ret[$prop] = $this->resource->get($prop);
126 126
             }
Please login to merge, or discard this patch.
controller/RestController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         // wrap with JSONP callback if requested
26 26
         if (filter_input(INPUT_GET, 'callback', FILTER_SANITIZE_STRING)) {
27 27
             header("Content-type: application/javascript; charset=utf-8");
28
-            echo filter_input(INPUT_GET, 'callback', FILTER_UNSAFE_RAW) . "(" . json_encode($data) . ");";
28
+            echo filter_input(INPUT_GET, 'callback', FILTER_UNSAFE_RAW)."(".json_encode($data).");";
29 29
             return;
30 30
         }
31 31
         
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
                 'vocabularies' => 'onki:hasVocabulary',
89 89
                 'id' => 'onki:vocabularyIdentifier',
90 90
                 'uri' => '@id',
91
-                '@base' => $this->getBaseHref() . "rest/v1/vocabularies",
91
+                '@base' => $this->getBaseHref()."rest/v1/vocabularies",
92 92
             ),
93 93
             'uri' => '',
94 94
             'vocabularies' => $results,
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         // convert to vocids array to support multi-vocabulary search
106 106
         $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : array();
107 107
         $vocabObjects = array();
108
-        foreach($vocids as $vocid) {
108
+        foreach ($vocids as $vocid) {
109 109
             $vocabObjects[] = $this->model->getVocabulary($vocid);
110 110
         }
111 111
         $parameters->setVocabularies($vocabObjects);
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
         if ($request->getQueryParam('labellang')) {
145 145
             $ret['@context']['@language'] = $request->getQueryParam('labellang');
146 146
         } elseif ($request->getQueryParam('lang')) {
147
-            $ret['@context']['@language'] = $request->getQueryParam('lang');;
147
+            $ret['@context']['@language'] = $request->getQueryParam('lang'); ;
148 148
         }
149 149
         return $ret;
150 150
     }
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
                 'prefLabel' => 'skos:prefLabel',
212 212
                 'title' => 'dct:title',
213 213
                 '@language' => $request->getLang(),
214
-                '@base' => $this->getBaseHref() . "rest/v1/" . $vocab->getId() . "/",
214
+                '@base' => $this->getBaseHref()."rest/v1/".$vocab->getId()."/",
215 215
             ),
216 216
             'uri' => '',
217 217
             'id' => $vocab->getId(),
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
                 'subTypes' => array('@id' => 'void:class', '@type' => '@id'),
262 262
                 'count' => 'void:entities',
263 263
                 '@language' => $request->getLang(),
264
-                '@base' => $this->getBaseHref() . "rest/v1/" . $request->getVocab()->getId() . "/",
264
+                '@base' => $this->getBaseHref()."rest/v1/".$request->getVocab()->getId()."/",
265 265
             ),
266 266
             'uri' => '',
267 267
             'id' => $request->getVocab()->getId(),
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
                 'language' => 'void-ext:language',
336 336
                 'properties' => 'void:propertyPartition',
337 337
                 'labels' => 'void:triples',
338
-                '@base' => $this->getBaseHref() . "rest/v1/" . $request->getVocab()->getId() . "/",
338
+                '@base' => $this->getBaseHref()."rest/v1/".$request->getVocab()->getId()."/",
339 339
             ),
340 340
             'uri' => '',
341 341
             'id' => $request->getVocab()->getId(),
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
             $types[] = $type;
373 373
         }
374 374
 
375
-        $base = $request->getVocab() ? $this->getBaseHref() . "rest/v1/" . $request->getVocab()->getId() . "/" : $this->getBaseHref() . "rest/v1/";
375
+        $base = $request->getVocab() ? $this->getBaseHref()."rest/v1/".$request->getVocab()->getId()."/" : $this->getBaseHref()."rest/v1/";
376 376
 
377 377
         $ret = array_merge_recursive($this->context, array(
378 378
             '@context' => array(
@@ -530,10 +530,10 @@  discard block
 block discarded – undo
530 530
 
531 531
         $format = $this->negotiateFormat(array_keys($urls), $request->getServerConstant('HTTP_ACCEPT'), $request->getQueryParam('format'));
532 532
         if (!$format) {
533
-            return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: " . implode(' ', array_keys($urls)));
533
+            return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: ".implode(' ', array_keys($urls)));
534 534
         }
535 535
 
536
-        header("Location: " . $urls[$format]);
536
+        header("Location: ".$urls[$format]);
537 537
     }
538 538
     
539 539
     private function returnDataResults($results, $format) {
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 
588 588
         $format = $this->negotiateFormat(explode(' ', self::SUPPORTED_FORMATS), $request->getServerConstant('HTTP_ACCEPT'), $request->getQueryParam('format'));
589 589
         if (!$format) {
590
-            return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: " . self::SUPPORTED_FORMATS);
590
+            return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: ".self::SUPPORTED_FORMATS);
591 591
         }
592 592
 
593 593
         $vocid = $vocab ? $vocab->getId() : null;
Please login to merge, or discard this patch.
model/Concept.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -122,12 +122,12 @@  discard block
 block discarded – undo
122 122
         // 3. label in any language
123 123
         $label = $this->resource->label();
124 124
         // if the label lang code is a subset of the ui lang eg. en-GB
125
-        if ($label !== null && strpos($label->getLang(), $lang . '-') === 0) {
125
+        if ($label !== null && strpos($label->getLang(), $lang.'-') === 0) {
126 126
             return EasyRdf_Literal::create($label, $lang);
127 127
         }
128 128
 
129 129
         if ($label !== null) {
130
-            return $label->getLang() ? $label->getValue() . " (" . $label->getLang() . ")" : $label->getValue();
130
+            return $label->getLang() ? $label->getValue()." (".$label->getLang().")" : $label->getValue();
131 131
         }
132 132
 
133 133
         // empty
@@ -452,14 +452,14 @@  discard block
 block discarded – undo
452 452
 
453 453
             // making a human readable string from the timestamps
454 454
             if ($created != '') {
455
-                $ret = gettext('skosmos:created') . ' ' . (Punic\Calendar::formatDate($created, 'short'));
455
+                $ret = gettext('skosmos:created').' '.(Punic\Calendar::formatDate($created, 'short'));
456 456
             }
457 457
 
458 458
             if ($modified != '') {
459 459
                 if ($created != '') {
460
-                    $ret .= ', ' . gettext('skosmos:modified') . ' ' . (Punic\Calendar::formatDate($modified, 'short'));
460
+                    $ret .= ', '.gettext('skosmos:modified').' '.(Punic\Calendar::formatDate($modified, 'short'));
461 461
                 } else {
462
-                    $ret .= ' ' . ucfirst(gettext('skosmos:modified')) . ' ' . (Punic\Calendar::formatDate($modified, 'short'));
462
+                    $ret .= ' '.ucfirst(gettext('skosmos:modified')).' '.(Punic\Calendar::formatDate($modified, 'short'));
463 463
                 }
464 464
 
465 465
             }
@@ -467,12 +467,12 @@  discard block
 block discarded – undo
467 467
             trigger_error($e->getMessage(), E_USER_WARNING);
468 468
             $ret = '';
469 469
             if ($this->resource->get('dc:modified')) {
470
-                $modified = (string) $this->resource->get('dc:modified');
471
-                $ret = gettext('skosmos:modified') . ' ' . $modified; 
470
+                $modified = (string)$this->resource->get('dc:modified');
471
+                $ret = gettext('skosmos:modified').' '.$modified; 
472 472
             }
473 473
             if ($this->resource->get('dc:created')) {
474
-                $created .= (string) $this->resource->get('dc:created');
475
-                $ret .= ' ' . gettext('skosmos:created') . ' ' . $created; 
474
+                $created .= (string)$this->resource->get('dc:created');
475
+                $ret .= ' '.gettext('skosmos:created').' '.$created; 
476 476
             }
477 477
         }
478 478
         return $ret;
@@ -580,13 +580,13 @@  discard block
 block discarded – undo
580 580
         $labels = array();
581 581
         foreach ($this->resource->allLiterals('skos:prefLabel') as $lit) {
582 582
             // filtering away subsets of the current language eg. en vs en-GB
583
-            if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang() . '-') !== 0) {
583
+            if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang().'-') !== 0) {
584 584
                 $labels[$this->literalLanguageToString($lit)][] = new ConceptPropertyValueLiteral($lit, 'skos:prefLabel');
585 585
             }
586 586
         }
587 587
         foreach ($this->resource->allLiterals('skos:altLabel') as $lit) {
588 588
             // filtering away subsets of the current language eg. en vs en-GB
589
-            if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang() . '-') !== 0) {
589
+            if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang().'-') !== 0) {
590 590
                 $labels[$this->literalLanguageToString($lit)][] = new ConceptPropertyValueLiteral($lit, 'skos:altLabel');
591 591
             }
592 592
         }
Please login to merge, or discard this patch.
model/sparql/GenericSparql.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
      * @param Vocabulary[]|null $vocabs
66 66
      * @return string
67 67
      */
68
-    protected function generateFromClause($vocabs=null) {
68
+    protected function generateFromClause($vocabs = null) {
69 69
         $graphs = array();
70 70
         $clause = '';
71 71
         if (!$vocabs) {
72 72
             return $this->graph !== '?graph' ? "FROM <$this->graph>" : '';
73 73
         }
74
-        foreach($vocabs as $vocab) {
74
+        foreach ($vocabs as $vocab) {
75 75
             $graph = $vocab->getGraph();
76 76
             if (!in_array($graph, $graphs)) {
77 77
                 array_push($graphs, $graph);
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
         foreach ($graphs as $graph) {
675 675
           $values[] = "<$graph>";
676 676
         }
677
-        return "FILTER (?graph IN (" . implode(',', $values) . "))";
677
+        return "FILTER (?graph IN (".implode(',', $values)."))";
678 678
     }
679 679
 
680 680
     /**
@@ -684,16 +684,16 @@  discard block
 block discarded – undo
684 684
      * @return string sparql query clauses
685 685
      */
686 686
     protected function formatLimitAndOffset($limit, $offset) {
687
-        $limit = ($limit) ? 'LIMIT ' . $limit : '';
688
-        $offset = ($offset) ? 'OFFSET ' . $offset : '';
687
+        $limit = ($limit) ? 'LIMIT '.$limit : '';
688
+        $offset = ($offset) ? 'OFFSET '.$offset : '';
689 689
         // eliminating whitespace and line changes when the conditions aren't needed.
690 690
         $limitandoffset = '';
691 691
         if ($limit && $offset) {
692
-            $limitandoffset = "\n" . $limit . "\n" . $offset;
692
+            $limitandoffset = "\n".$limit."\n".$offset;
693 693
         } elseif ($limit) {
694
-            $limitandoffset = "\n" . $limit;
694
+            $limitandoffset = "\n".$limit;
695 695
         } elseif ($offset) {
696
-            $limitandoffset = "\n" . $offset;
696
+            $limitandoffset = "\n".$offset;
697 697
         }
698 698
 
699 699
         return $limitandoffset;
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
             }
714 714
         }
715 715
 
716
-        return implode(' UNION ', $typePatterns);;
716
+        return implode(' UNION ', $typePatterns); ;
717 717
     }
718 718
 
719 719
     /**
@@ -845,14 +845,14 @@  discard block
 block discarded – undo
845 845
         // if search language and UI/display language differ, must also consider case where there is no prefLabel in
846 846
         // the display language; in that case, should use the label with the same language as the matched label
847 847
         $labelcondFallback = ($searchLang != $lang) ?
848
-          "OPTIONAL { # in case previous OPTIONAL block gives no labels\n" .
848
+          "OPTIONAL { # in case previous OPTIONAL block gives no labels\n".
849 849
           "?s skos:prefLabel ?label . FILTER (LANGMATCHES(LANG(?label), LANG(?match))) }" : "";
850 850
           
851 851
         //  Including the labels if there is no query term given.
852 852
         if ($rawterm === '') {
853 853
           $labelClause = "?s skos:prefLabel ?label .";
854
-          $labelClause = ($lang) ? $labelClause . " FILTER (LANGMATCHES(LANG(?label), '$lang'))" : $labelClause . "";
855
-          return $labelClause . " BIND(?label AS ?match)";
854
+          $labelClause = ($lang) ? $labelClause." FILTER (LANGMATCHES(LANG(?label), '$lang'))" : $labelClause."";
855
+          return $labelClause." BIND(?label AS ?match)";
856 856
         }
857 857
 
858 858
         /*
@@ -912,15 +912,15 @@  discard block
 block discarded – undo
912 912
 
913 913
         $schemecond = '';
914 914
         if (!empty($schemes)) {
915
-            foreach($schemes as $scheme) {
915
+            foreach ($schemes as $scheme) {
916 916
                 $schemecond .= "?s skos:inScheme <$scheme> . ";
917 917
             }
918 918
         }
919 919
 
920 920
         // extra conditions for parent and group, if specified
921
-        $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <" . $params->getParentLimit() . "> ." : "";
922
-        $groupcond = ($params->getGroupLimit()) ? "<" . $params->getGroupLimit() . "> skos:member ?s ." : "";
923
-        $pgcond = $parentcond . $groupcond;
921
+        $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <".$params->getParentLimit()."> ." : "";
922
+        $groupcond = ($params->getGroupLimit()) ? "<".$params->getGroupLimit()."> skos:member ?s ." : "";
923
+        $pgcond = $parentcond.$groupcond;
924 924
 
925 925
         $orderextra = $this->isDefaultEndpoint() ? $this->graph : '';
926 926
 
@@ -994,9 +994,9 @@  discard block
 block discarded – undo
994 994
             $hit['type'][] = $this->shortenUri($typeuri);
995 995
         }
996 996
 
997
-        if(!empty($fields)) {
997
+        if (!empty($fields)) {
998 998
             foreach ($fields as $prop) {
999
-                $propname = $prop . 's';
999
+                $propname = $prop.'s';
1000 1000
                 if (isset($row->$propname)) {
1001 1001
                     foreach (explode("\n", $row->$propname->getValue()) as $line) {
1002 1002
                         $rdata = str_getcsv($line, ',', '"', '"');
@@ -1011,7 +1011,7 @@  discard block
 block discarded – undo
1011 1011
                             $propvals = $rdata[2];
1012 1012
                         }
1013 1013
 
1014
-                        $hit['skos:' . $prop][] = $propvals;
1014
+                        $hit['skos:'.$prop][] = $propvals;
1015 1015
                     }
1016 1016
                 }
1017 1017
             }
@@ -1472,7 +1472,7 @@  discard block
 block discarded – undo
1472 1472
                 if (!isset($row->label) || $row->label->getLang() === $lang) {
1473 1473
                     $ret[$row->object->getUri()] = $val;
1474 1474
                 } elseif ($row->label->getLang() === $fallbacklang) {
1475
-                    $val['label'] .= ' (' . $row->label->getLang() . ')';
1475
+                    $val['label'] .= ' ('.$row->label->getLang().')';
1476 1476
                     $ret[$row->object->getUri()] = $val;
1477 1477
                 }
1478 1478
             }
@@ -1571,7 +1571,7 @@  discard block
 block discarded – undo
1571 1571
                 if ($row->label->getLang() == $lang) {
1572 1572
                     $label = $row->label->getValue();
1573 1573
                 } else {
1574
-                    $label = $row->label->getValue() . " (" . $row->label->getLang() . ")";
1574
+                    $label = $row->label->getValue()." (".$row->label->getLang().")";
1575 1575
                 }
1576 1576
 
1577 1577
             }
@@ -1736,7 +1736,7 @@  discard block
 block discarded – undo
1736 1736
                 if (isset($row->childlabel)) {
1737 1737
                     $label = $row->childlabel->getValue();
1738 1738
                     if ($row->childlabel->getLang() !== $lang) {
1739
-                        $label .= " (" . $row->childlabel->getLang() . ")";
1739
+                        $label .= " (".$row->childlabel->getLang().")";
1740 1740
                     }
1741 1741
 
1742 1742
                 }
@@ -1758,7 +1758,7 @@  discard block
 block discarded – undo
1758 1758
             if (isset($row->label)) {
1759 1759
                 $preflabel = $row->label->getValue();
1760 1760
                 if ($row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang) !== 0) {
1761
-                    $preflabel .= ' (' . $row->label->getLang() . ')';
1761
+                    $preflabel .= ' ('.$row->label->getLang().')';
1762 1762
                 }
1763 1763
 
1764 1764
                 $ret[$uri]['prefLabel'] = $preflabel;
@@ -1918,7 +1918,7 @@  discard block
 block discarded – undo
1918 1918
                     if ($row->label->getLang() == $lang) {
1919 1919
                         $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue();
1920 1920
                     } else {
1921
-                        $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue() . " (" . $row->label->getLang() . ")";
1921
+                        $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue()." (".$row->label->getLang().")";
1922 1922
                     }
1923 1923
 
1924 1924
                 }
@@ -1959,7 +1959,7 @@  discard block
 block discarded – undo
1959 1959
      */
1960 1960
     private function generateChangeListQuery($lang, $offset, $prop) {
1961 1961
         $fcl = $this->generateFromClause();
1962
-        $offset = ($offset) ? 'OFFSET ' . $offset : '';
1962
+        $offset = ($offset) ? 'OFFSET '.$offset : '';
1963 1963
 
1964 1964
         $query = <<<EOQ
1965 1965
 SELECT DISTINCT ?concept ?date ?label $fcl
Please login to merge, or discard this patch.