Completed
Push — master ( b31cdb...c75d37 )
by Henri
02:51
created
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.
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/ConceptProperty.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      * @param string $prop property type eg. 'rdf:type'.
22 22
      * @param string $label
23 23
      */
24
-    public function __construct($prop, $label, $super=null)
24
+    public function __construct($prop, $label, $super = null)
25 25
     {
26 26
         $this->prop = $prop;
27 27
         $this->label = $label;
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      */
60 60
     public function getDescription()
61 61
     {
62
-        $helpprop = $this->prop . "_help";
62
+        $helpprop = $this->prop."_help";
63 63
 
64 64
         return gettext($helpprop); // can't use string constant, it'd be picked up by xgettext
65 65
     }
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
     public function addValue($value)
80 80
     {
81
-        $this->values[$value->getNotation() . $value->getLabel() . $value->getUri()] = $value;
81
+        $this->values[$value->getNotation().$value->getLabel().$value->getUri()] = $value;
82 82
         $this->is_sorted = false;
83 83
     }
84 84
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     {
87 87
         if (!empty($this->values)) {
88 88
             uksort($this->values, function($a, $b) {
89
-                return strnatcasecmp($a,$b);
89
+                return strnatcasecmp($a, $b);
90 90
             });
91 91
         }
92 92
         $this->is_sorted = true;
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
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
         // register a Twig filter for generating URLs for vocabulary resources (concepts and groups)
66 66
         $controller = $this; // for use by anonymous function below
67
-        $urlFilter = new Twig_SimpleFilter('link_url', function ($uri, $vocab, $lang, $type = 'page', $clang = null, $term = null) use ($controller) {
67
+        $urlFilter = new Twig_SimpleFilter('link_url', function($uri, $vocab, $lang, $type = 'page', $clang = null, $term = null) use ($controller) {
68 68
             // $vocab can either be null, a vocabulary id (string) or a Vocabulary object
69 69
             if ($vocab === null) {
70 70
                 // target vocabulary is unknown, best bet is to link to the plain URI
@@ -89,23 +89,23 @@  discard block
 block discarded – undo
89 89
             $localname = $vocab->getLocalName($uri);
90 90
             if ($localname !== $uri && $localname === urlencode($localname)) {
91 91
                 // check that the prefix stripping worked, and there are no problematic chars in localname
92
-                $paramstr = sizeof($params) > 0 ? '?' . http_build_query($params) : '';
92
+                $paramstr = sizeof($params) > 0 ? '?'.http_build_query($params) : '';
93 93
                 if ($type && $type !== '' && $type !== 'vocab' && !($localname === '' && $type === 'page')) {
94
-                    return "$vocid/$lang/$type/$localname" . $paramstr;
94
+                    return "$vocid/$lang/$type/$localname".$paramstr;
95 95
                 }
96 96
 
97
-                return "$vocid/$lang/$localname" . $paramstr;
97
+                return "$vocid/$lang/$localname".$paramstr;
98 98
             }
99 99
 
100 100
             // case 2: URI outside vocabulary namespace, or has problematic chars
101 101
             // pass the full URI as parameter instead
102 102
             $params['uri'] = $uri;
103
-            return "$vocid/$lang/$type/?" . http_build_query($params);
103
+            return "$vocid/$lang/$type/?".http_build_query($params);
104 104
         });
105 105
         $this->twig->addFilter($urlFilter);
106 106
 
107 107
         // register a Twig filter for generating strings from language codes with CLDR
108
-        $langFilter = new Twig_SimpleFilter('lang_name', function ($langcode, $lang) {
108
+        $langFilter = new Twig_SimpleFilter('lang_name', function($langcode, $lang) {
109 109
             return Language::getName($langcode, $lang);
110 110
         });
111 111
         $this->twig->addFilter($langFilter);
@@ -265,12 +265,12 @@  discard block
 block discarded – undo
265 265
     private function createFeedbackHeaders($fromName, $fromEmail, $toMail)
266 266
     {
267 267
         $headers = "MIME-Version: 1.0″ . '\r\n";
268
-        $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";
268
+        $headers .= "Content-type: text/html; charset=UTF-8"."\r\n";
269 269
         if ($toMail) {
270
-            $headers .= "Cc: " . $this->model->getConfig()->getFeedbackAddress() . "\r\n";
270
+            $headers .= "Cc: ".$this->model->getConfig()->getFeedbackAddress()."\r\n";
271 271
         }
272 272
 
273
-        $headers .= "From: $fromName <$fromEmail>" . "\r\n" . 'X-Mailer: PHP/' . phpversion();
273
+        $headers .= "From: $fromName <$fromEmail>"."\r\n".'X-Mailer: PHP/'.phpversion();
274 274
         return $headers;
275 275
     }
276 276
 
@@ -285,20 +285,20 @@  discard block
 block discarded – undo
285 285
     {
286 286
         $toAddress = ($toMail) ? $toMail : $this->model->getConfig()->getFeedbackAddress();
287 287
         if ($fromVocab && $fromVocab !== '') {
288
-            $message = 'Feedback from vocab: ' . strtoupper($fromVocab) . "<br />" . $message;
288
+            $message = 'Feedback from vocab: '.strtoupper($fromVocab)."<br />".$message;
289 289
         }
290 290
 
291
-        $subject = SERVICE_NAME . " feedback";
291
+        $subject = SERVICE_NAME." feedback";
292 292
         $headers = $this->createFeedbackHeaders($fromName, $fromEmail, $toMail);
293 293
         $envelopeSender = FEEDBACK_ENVELOPE_SENDER;
294 294
         $params = empty($envelopeSender) ? '' : "-f $envelopeSender";
295 295
 
296 296
         // adding some information about the user for debugging purposes.
297
-        $message = $message . "<br /><br /> Debugging information:"
298
-            . "<br />Timestamp: " . date(DATE_RFC2822)
299
-            . "<br />User agent: " . $request->getServerConstant('HTTP_USER_AGENT')
300
-            . "<br />IP address: " . $request->getServerConstant('REMOTE_ADDR')
301
-            . "<br />Referer: " . $request->getServerConstant('HTTP_REFERER');
297
+        $message = $message."<br /><br /> Debugging information:"
298
+            . "<br />Timestamp: ".date(DATE_RFC2822)
299
+            . "<br />User agent: ".$request->getServerConstant('HTTP_USER_AGENT')
300
+            . "<br />IP address: ".$request->getServerConstant('REMOTE_ADDR')
301
+            . "<br />Referer: ".$request->getServerConstant('HTTP_REFERER');
302 302
 
303 303
         try {
304 304
             mail($toAddress, $subject, $message, $headers, $params);
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
             header("HTTP/1.0 404 Not Found");
307 307
             $template = $this->twig->loadTemplate('error-page.twig');
308 308
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
309
-                error_log('Caught exception: ' . $e->getMessage());
309
+                error_log('Caught exception: '.$e->getMessage());
310 310
             }
311 311
 
312 312
             echo $template->render(
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
         $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : null;
354 354
         $vocabObjects = array();
355 355
         if ($vocids) {
356
-            foreach($vocids as $vocid) {
356
+            foreach ($vocids as $vocid) {
357 357
                 $vocabObjects[] = $this->model->getVocabulary($vocid);
358 358
             }
359 359
         }
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
         } catch (Exception $e) {
365 365
             header("HTTP/1.0 404 Not Found");
366 366
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
367
-                error_log('Caught exception: ' . $e->getMessage());
367
+                error_log('Caught exception: '.$e->getMessage());
368 368
             }
369 369
             $this->invokeGenericErrorPage($request, $e->getMessage());
370 370
             return;
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
                 'search_count' => $counts,
381 381
                 'languages' => $this->languages,
382 382
                 'search_results' => $searchResults,
383
-                'rest' => $parameters->getOffset()>0,
383
+                'rest' => $parameters->getOffset() > 0,
384 384
                 'global_search' => true,
385 385
                 'term' => $request->getQueryParam('q'),
386 386
                 'lang_list' => $langList,
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
         } catch (Exception $e) {
406 406
             header("HTTP/1.0 404 Not Found");
407 407
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
408
-                error_log('Caught exception: ' . $e->getMessage());
408
+                error_log('Caught exception: '.$e->getMessage());
409 409
             }
410 410
 
411 411
             echo $template->render(
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
         } catch (Exception $e) {
427 427
             header("HTTP/1.0 404 Not Found");
428 428
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
429
-                error_log('Caught exception: ' . $e->getMessage());
429
+                error_log('Caught exception: '.$e->getMessage());
430 430
             }
431 431
 
432 432
             echo $template->render(
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
                 'vocab' => $vocab,
444 444
                 'search_results' => $searchResults,
445 445
                 'search_count' => $counts,
446
-                'rest' => $parameters->getOffset()>0,
446
+                'rest' => $parameters->getOffset() > 0,
447 447
                 'limit_parent' => $parameters->getParentLimit(),
448 448
                 'limit_type' =>  $request->getQueryParam('type') ? explode('+', $request->getQueryParam('type')) : null,
449 449
                 'limit_group' => $parameters->getGroupLimit(),
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
      * Loads and renders the view containing a list of recent changes in the vocabulary.
569 569
      * @param Request $request
570 570
      */
571
-    public function invokeChangeList($request, $prop='dc:created')
571
+    public function invokeChangeList($request, $prop = 'dc:created')
572 572
     {
573 573
         // set language parameters for gettext
574 574
         $this->setLanguageProperties($request->getLang());
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->propertyUris();
123
-        foreach($props as $prop) {
123
+        foreach ($props as $prop) {
124 124
             $prop = (EasyRdf_Namespace::shorten($prop) !== null) ? EasyRdf_Namespace::shorten($prop) : $prop;
125 125
             foreach ($this->resource->allLiterals($prop) as $val) {
126 126
                 if ($prop !== 'rdf:value' && $this->resource->get($prop)) { // shown elsewhere
Please login to merge, or discard this patch.
model/sparql/GenericSparql.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         $starttime = microtime();
72 72
         $result = $this->client->query($query);
73 73
         $elapsed = intval(round((microtime() - $starttime) * 1000));
74
-        if(method_exists($result, 'numRows')) {
74
+        if (method_exists($result, 'numRows')) {
75 75
             $numRows = $result->numRows();
76 76
             $logger->info("[qid $queryId] result: $numRows rows returned in $elapsed ms");
77 77
         } else { // graph result
@@ -87,20 +87,20 @@  discard block
 block discarded – undo
87 87
      * @param Vocabulary[]|null $vocabs
88 88
      * @return string
89 89
      */
90
-    protected function generateFromClause($vocabs=null) {
90
+    protected function generateFromClause($vocabs = null) {
91 91
         $graphs = array();
92 92
         $clause = '';
93 93
         if (!$vocabs) {
94 94
             return $this->graph !== '?graph' && $this->graph !== NULL ? "FROM <$this->graph>" : '';
95 95
         }
96
-        foreach($vocabs as $vocab) {
96
+        foreach ($vocabs as $vocab) {
97 97
             $graph = $vocab->getGraph();
98 98
             if (!in_array($graph, $graphs)) {
99 99
                 array_push($graphs, $graph);
100 100
             }
101 101
         }
102 102
         foreach ($graphs as $graph) {
103
-            if($graph !== NULL)
103
+            if ($graph !== NULL)
104 104
                 $clause .= "FROM NAMED <$graph> "; 
105 105
         }
106 106
         return $clause;
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
         foreach ($graphs as $graph) {
698 698
           $values[] = "<$graph>";
699 699
         }
700
-        return "FILTER (?graph IN (" . implode(',', $values) . "))";
700
+        return "FILTER (?graph IN (".implode(',', $values)."))";
701 701
     }
702 702
 
703 703
     /**
@@ -707,16 +707,16 @@  discard block
 block discarded – undo
707 707
      * @return string sparql query clauses
708 708
      */
709 709
     protected function formatLimitAndOffset($limit, $offset) {
710
-        $limit = ($limit) ? 'LIMIT ' . $limit : '';
711
-        $offset = ($offset) ? 'OFFSET ' . $offset : '';
710
+        $limit = ($limit) ? 'LIMIT '.$limit : '';
711
+        $offset = ($offset) ? 'OFFSET '.$offset : '';
712 712
         // eliminating whitespace and line changes when the conditions aren't needed.
713 713
         $limitandoffset = '';
714 714
         if ($limit && $offset) {
715
-            $limitandoffset = "\n" . $limit . "\n" . $offset;
715
+            $limitandoffset = "\n".$limit."\n".$offset;
716 716
         } elseif ($limit) {
717
-            $limitandoffset = "\n" . $limit;
717
+            $limitandoffset = "\n".$limit;
718 718
         } elseif ($offset) {
719
-            $limitandoffset = "\n" . $offset;
719
+            $limitandoffset = "\n".$offset;
720 720
         }
721 721
 
722 722
         return $limitandoffset;
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
             }
737 737
         }
738 738
 
739
-        return implode(' UNION ', $typePatterns);;
739
+        return implode(' UNION ', $typePatterns); ;
740 740
     }
741 741
 
742 742
     /**
@@ -868,14 +868,14 @@  discard block
 block discarded – undo
868 868
         // if search language and UI/display language differ, must also consider case where there is no prefLabel in
869 869
         // the display language; in that case, should use the label with the same language as the matched label
870 870
         $labelcondFallback = ($searchLang != $lang) ?
871
-          "OPTIONAL { # in case previous OPTIONAL block gives no labels\n" .
871
+          "OPTIONAL { # in case previous OPTIONAL block gives no labels\n".
872 872
           "?s skos:prefLabel ?label . FILTER (LANGMATCHES(LANG(?label), LANG(?match))) }" : "";
873 873
           
874 874
         //  Including the labels if there is no query term given.
875 875
         if ($rawterm === '') {
876 876
           $labelClause = "?s skos:prefLabel ?label .";
877
-          $labelClause = ($lang) ? $labelClause . " FILTER (LANGMATCHES(LANG(?label), '$lang'))" : $labelClause . "";
878
-          return $labelClause . " BIND(?label AS ?match)";
877
+          $labelClause = ($lang) ? $labelClause." FILTER (LANGMATCHES(LANG(?label), '$lang'))" : $labelClause."";
878
+          return $labelClause." BIND(?label AS ?match)";
879 879
         }
880 880
 
881 881
         /*
@@ -936,15 +936,15 @@  discard block
 block discarded – undo
936 936
 
937 937
         $schemecond = '';
938 938
         if (!empty($schemes)) {
939
-            foreach($schemes as $scheme) {
939
+            foreach ($schemes as $scheme) {
940 940
                 $schemecond .= "?s skos:inScheme <$scheme> . ";
941 941
             }
942 942
         }
943 943
 
944 944
         // extra conditions for parent and group, if specified
945
-        $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <" . $params->getParentLimit() . "> ." : "";
946
-        $groupcond = ($params->getGroupLimit()) ? "<" . $params->getGroupLimit() . "> skos:member ?s ." : "";
947
-        $pgcond = $parentcond . $groupcond;
945
+        $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <".$params->getParentLimit()."> ." : "";
946
+        $groupcond = ($params->getGroupLimit()) ? "<".$params->getGroupLimit()."> skos:member ?s ." : "";
947
+        $pgcond = $parentcond.$groupcond;
948 948
 
949 949
         $orderextra = $this->isDefaultEndpoint() ? $this->graph : '';
950 950
 
@@ -1018,9 +1018,9 @@  discard block
 block discarded – undo
1018 1018
             $hit['type'][] = $this->shortenUri($typeuri);
1019 1019
         }
1020 1020
 
1021
-        if(!empty($fields)) {
1021
+        if (!empty($fields)) {
1022 1022
             foreach ($fields as $prop) {
1023
-                $propname = $prop . 's';
1023
+                $propname = $prop.'s';
1024 1024
                 if (isset($row->$propname)) {
1025 1025
                     foreach (explode("\n", $row->$propname->getValue()) as $line) {
1026 1026
                         $rdata = str_getcsv($line, ',', '"', '"');
@@ -1035,7 +1035,7 @@  discard block
 block discarded – undo
1035 1035
                             $propvals = $rdata[2];
1036 1036
                         }
1037 1037
 
1038
-                        $hit['skos:' . $prop][] = $propvals;
1038
+                        $hit['skos:'.$prop][] = $propvals;
1039 1039
                     }
1040 1040
                 }
1041 1041
             }
@@ -1494,7 +1494,7 @@  discard block
 block discarded – undo
1494 1494
                 if (!isset($row->label) || $row->label->getLang() === $lang) {
1495 1495
                     $ret[$row->object->getUri()] = $val;
1496 1496
                 } elseif ($row->label->getLang() === $fallbacklang) {
1497
-                    $val['label'] .= ' (' . $row->label->getLang() . ')';
1497
+                    $val['label'] .= ' ('.$row->label->getLang().')';
1498 1498
                     $ret[$row->object->getUri()] = $val;
1499 1499
                 }
1500 1500
             }
@@ -1590,10 +1590,10 @@  discard block
 block discarded – undo
1590 1590
 
1591 1591
             $label = null;
1592 1592
             if (isset($row->label)) {
1593
-                if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang . "-") == 0) {
1593
+                if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang."-") == 0) {
1594 1594
                     $label = $row->label->getValue();
1595 1595
                 } else {
1596
-                    $label = $row->label->getValue() . " (" . $row->label->getLang() . ")";
1596
+                    $label = $row->label->getValue()." (".$row->label->getLang().")";
1597 1597
                 }
1598 1598
 
1599 1599
             }
@@ -1669,8 +1669,8 @@  discard block
 block discarded – undo
1669 1669
         foreach ($result as $row) {
1670 1670
             if (isset($row->top) && isset($row->label)) {
1671 1671
                 $label = $row->label->getValue();
1672
-                if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang . "-") !== 0) {
1673
-                    $label .= ' (' . $row->label->getLang() . ')';
1672
+                if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang."-") !== 0) {
1673
+                    $label .= ' ('.$row->label->getLang().')';
1674 1674
                 }
1675 1675
                 $top = array('uri' => $row->top->getUri(), 'topConceptOf' => $row->topuri->getUri(), 'label' => $label, 'hasChildren' => filter_var($row->children->getValue(), FILTER_VALIDATE_BOOLEAN));
1676 1676
                 if (isset($row->notation)) {
@@ -1771,8 +1771,8 @@  discard block
 block discarded – undo
1771 1771
                 $label = null;
1772 1772
                 if (isset($row->childlabel)) {
1773 1773
                     $label = $row->childlabel->getValue();
1774
-                    if ($row->childlabel->getLang() !== $lang && strpos($row->childlabel->getLang(), $lang . "-") !== 0) {
1775
-                        $label .= " (" . $row->childlabel->getLang() . ")";
1774
+                    if ($row->childlabel->getLang() !== $lang && strpos($row->childlabel->getLang(), $lang."-") !== 0) {
1775
+                        $label .= " (".$row->childlabel->getLang().")";
1776 1776
                     }
1777 1777
 
1778 1778
                 }
@@ -1793,8 +1793,8 @@  discard block
 block discarded – undo
1793 1793
             }
1794 1794
             if (isset($row->label)) {
1795 1795
                 $preflabel = $row->label->getValue();
1796
-                if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang . "-") !== 0) {
1797
-                    $preflabel .= ' (' . $row->label->getLang() . ')';
1796
+                if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang."-") !== 0) {
1797
+                    $preflabel .= ' ('.$row->label->getLang().')';
1798 1798
                 }
1799 1799
 
1800 1800
                 $ret[$uri]['prefLabel'] = $preflabel;
@@ -1951,10 +1951,10 @@  discard block
 block discarded – undo
1951 1951
                     'type' => array($row->type->shorten()),
1952 1952
                 );
1953 1953
                 if (isset($row->label)) {
1954
-                    if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang . "-") == 0) {
1954
+                    if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang."-") == 0) {
1955 1955
                         $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue();
1956 1956
                     } else {
1957
-                        $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue() . " (" . $row->label->getLang() . ")";
1957
+                        $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue()." (".$row->label->getLang().")";
1958 1958
                     }
1959 1959
 
1960 1960
                 }
@@ -1995,7 +1995,7 @@  discard block
 block discarded – undo
1995 1995
      */
1996 1996
     private function generateChangeListQuery($lang, $offset, $prop) {
1997 1997
         $fcl = $this->generateFromClause();
1998
-        $offset = ($offset) ? 'OFFSET ' . $offset : '';
1998
+        $offset = ($offset) ? 'OFFSET '.$offset : '';
1999 1999
 
2000 2000
         $query = <<<EOQ
2001 2001
 SELECT DISTINCT ?concept ?date ?label $fcl
Please login to merge, or discard this patch.
model/Concept.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
 
122 122
         // 3. label in a subtag of the current language
123 123
         // We need to check all the labels in case one of them matches a subtag of the current language
124
-        foreach($this->resource->allLiterals('skos:prefLabel') as $label) {
124
+        foreach ($this->resource->allLiterals('skos:prefLabel') as $label) {
125 125
             // the label lang code is a subtag of the UI lang eg. en-GB - create a new literal with the main language
126
-            if ($label !== null && strpos($label->getLang(), $lang . '-') === 0) {
126
+            if ($label !== null && strpos($label->getLang(), $lang.'-') === 0) {
127 127
                 return EasyRdf_Literal::create($label, $lang);
128 128
             }
129 129
         }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
         // 4. label in any language, including literal with empty language tag
132 132
         $label = $this->resource->label();
133 133
         if ($label !== null) {
134
-            return $label->getLang() ? $label->getValue() . " (" . $label->getLang() . ")" : $label->getValue();
134
+            return $label->getLang() ? $label->getValue()." (".$label->getLang().")" : $label->getValue();
135 135
         }
136 136
 
137 137
         // empty
@@ -456,14 +456,14 @@  discard block
 block discarded – undo
456 456
 
457 457
             // making a human readable string from the timestamps
458 458
             if ($created != '') {
459
-                $ret = gettext('skosmos:created') . ' ' . (Punic\Calendar::formatDate($created, 'short'));
459
+                $ret = gettext('skosmos:created').' '.(Punic\Calendar::formatDate($created, 'short'));
460 460
             }
461 461
 
462 462
             if ($modified != '') {
463 463
                 if ($created != '') {
464
-                    $ret .= ', ' . gettext('skosmos:modified') . ' ' . (Punic\Calendar::formatDate($modified, 'short'));
464
+                    $ret .= ', '.gettext('skosmos:modified').' '.(Punic\Calendar::formatDate($modified, 'short'));
465 465
                 } else {
466
-                    $ret .= ' ' . ucfirst(gettext('skosmos:modified')) . ' ' . (Punic\Calendar::formatDate($modified, 'short'));
466
+                    $ret .= ' '.ucfirst(gettext('skosmos:modified')).' '.(Punic\Calendar::formatDate($modified, 'short'));
467 467
                 }
468 468
 
469 469
             }
@@ -471,12 +471,12 @@  discard block
 block discarded – undo
471 471
             trigger_error($e->getMessage(), E_USER_WARNING);
472 472
             $ret = '';
473 473
             if ($this->resource->get('dc:modified')) {
474
-                $modified = (string) $this->resource->get('dc:modified');
475
-                $ret = gettext('skosmos:modified') . ' ' . $modified; 
474
+                $modified = (string)$this->resource->get('dc:modified');
475
+                $ret = gettext('skosmos:modified').' '.$modified; 
476 476
             }
477 477
             if ($this->resource->get('dc:created')) {
478
-                $created .= (string) $this->resource->get('dc:created');
479
-                $ret .= ' ' . gettext('skosmos:created') . ' ' . $created; 
478
+                $created .= (string)$this->resource->get('dc:created');
479
+                $ret .= ' '.gettext('skosmos:created').' '.$created; 
480 480
             }
481 481
         }
482 482
         return $ret;
@@ -584,13 +584,13 @@  discard block
 block discarded – undo
584 584
         $labels = array();
585 585
         foreach ($this->resource->allLiterals('skos:prefLabel') as $lit) {
586 586
             // filtering away subsets of the current language eg. en vs en-GB
587
-            if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang() . '-') !== 0) {
587
+            if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang().'-') !== 0) {
588 588
                 $labels[$this->literalLanguageToString($lit)][] = new ConceptPropertyValueLiteral($lit, 'skos:prefLabel');
589 589
             }
590 590
         }
591 591
         foreach ($this->resource->allLiterals('skos:altLabel') as $lit) {
592 592
             // filtering away subsets of the current language eg. en vs en-GB
593
-            if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang() . '-') !== 0) {
593
+            if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang().'-') !== 0) {
594 594
                 $labels[$this->literalLanguageToString($lit)][] = new ConceptPropertyValueLiteral($lit, 'skos:altLabel');
595 595
             }
596 596
         }
Please login to merge, or discard this patch.