Passed
Push — fix-rest-callback-quotes-skosm... ( 68d90a )
by Osma
06:30
created
controller/RestController.php 1 patch
Spacing   +19 added lines, -19 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_FULL_SPECIAL_CHARS)) {
27 27
             header("Content-type: application/javascript; charset=utf-8");
28
-            echo filter_input(INPUT_GET, 'callback', FILTER_SANITIZE_FULL_SPECIAL_CHARS, FILTER_FLAG_NO_ENCODE_QUOTES) . "(" . json_encode($data) . ");";
28
+            echo filter_input(INPUT_GET, 'callback', FILTER_SANITIZE_FULL_SPECIAL_CHARS, FILTER_FLAG_NO_ENCODE_QUOTES)."(".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);
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
         foreach ($parameters->getAdditionalFields() as $field) {
137 137
 
138 138
             // Quick-and-dirty compactification
139
-            $context[$field] = 'skos:' . $field;
139
+            $context[$field] = 'skos:'.$field;
140 140
             foreach ($results as &$result) {
141 141
                 foreach ($result as $k => $v) {
142
-                    if ($k == 'skos:' . $field) {
142
+                    if ($k == 'skos:'.$field) {
143 143
                         $result[$field] = $v;
144
-                        unset($result['skos:' . $field]);
144
+                        unset($result['skos:'.$field]);
145 145
                     }
146 146
                 }
147 147
             }
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
                 'prefLabel' => 'skos:prefLabel',
233 233
                 'title' => 'dct:title',
234 234
                 '@language' => $request->getLang(),
235
-                '@base' => $this->getBaseHref() . "rest/v1/" . $vocab->getId() . "/",
235
+                '@base' => $this->getBaseHref()."rest/v1/".$vocab->getId()."/",
236 236
             ),
237 237
             'uri' => '',
238 238
             'id' => $vocab->getId(),
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
                 'subTypes' => array('@id' => 'void:class', '@type' => '@id'),
288 288
                 'count' => 'void:entities',
289 289
                 '@language' => $request->getLang(),
290
-                '@base' => $this->getBaseHref() . "rest/v1/" . $request->getVocab()->getId() . "/",
290
+                '@base' => $this->getBaseHref()."rest/v1/".$request->getVocab()->getId()."/",
291 291
             ),
292 292
             'uri' => '',
293 293
             'id' => $request->getVocab()->getId(),
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
                 'language' => 'void-ext:language',
370 370
                 'properties' => 'void:propertyPartition',
371 371
                 'labels' => 'void:triples',
372
-                '@base' => $this->getBaseHref() . "rest/v1/" . $request->getVocab()->getId() . "/",
372
+                '@base' => $this->getBaseHref()."rest/v1/".$request->getVocab()->getId()."/",
373 373
             ),
374 374
             'uri' => '',
375 375
             'id' => $request->getVocab()->getId(),
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
             $types[] = $type;
411 411
         }
412 412
 
413
-        $base = $request->getVocab() ? $this->getBaseHref() . "rest/v1/" . $request->getVocab()->getId() . "/" : $this->getBaseHref() . "rest/v1/";
413
+        $base = $request->getVocab() ? $this->getBaseHref()."rest/v1/".$request->getVocab()->getId()."/" : $this->getBaseHref()."rest/v1/";
414 414
 
415 415
         $ret = array_merge_recursive($this->context, array(
416 416
             '@context' => array(
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
         if ($lang === null) {
452 452
             // case 1A: exact match on preferred label in any language
453 453
             foreach ($results as $res) {
454
-                if (isset($res['matchedPrefLabel']) && $res['matchedPrefLabel']  == $label) {
454
+                if (isset($res['matchedPrefLabel']) && $res['matchedPrefLabel'] == $label) {
455 455
                     $res['prefLabel'] = $res['matchedPrefLabel'];
456 456
                     unset($res['matchedPrefLabel']);
457 457
                     $hits[] = $res;
@@ -573,19 +573,19 @@  discard block
 block discarded – undo
573 573
 
574 574
         $format = $this->negotiateFormat(array_keys($urls), $request->getServerConstant('HTTP_ACCEPT'), $request->getQueryParam('format'));
575 575
         if (!$format) {
576
-            return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: " . implode(' ', array_keys($urls)));
576
+            return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: ".implode(' ', array_keys($urls)));
577 577
         }
578 578
         if (is_array($urls[$format])) {
579 579
             $arr = $urls[$format];
580 580
             $dataLang = $request->getLang();
581 581
             if (isset($arr[$dataLang])) {
582
-                header("Location: " . $arr[$dataLang]);
582
+                header("Location: ".$arr[$dataLang]);
583 583
             } else {
584 584
                 $vocid = $request->getVocab()->getId();
585 585
                 return $this->returnError('404', 'Not Found', "No download source URL known for vocabulary $vocid in language $dataLang");
586 586
             }
587 587
 		} else {
588
-            header("Location: " . $urls[$format]);
588
+            header("Location: ".$urls[$format]);
589 589
 		}
590 590
     }
591 591
 
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 
649 649
         $format = $this->negotiateFormat(explode(' ', self::SUPPORTED_FORMATS), $request->getServerConstant('HTTP_ACCEPT'), $request->getQueryParam('format'));
650 650
         if (!$format) {
651
-            return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: " . self::SUPPORTED_FORMATS);
651
+            return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: ".self::SUPPORTED_FORMATS);
652 652
         }
653 653
 
654 654
         $vocid = $vocab ? $vocab->getId() : null;
@@ -933,7 +933,7 @@  discard block
 block discarded – undo
933 933
                         }
934 934
                     }
935 935
                     // if the main concept scheme was not found, set 'top' to the first 'tops' (sorted alphabetically on the URIs)
936
-                    if (! isset($results[$uri]['top'])) {
936
+                    if (!isset($results[$uri]['top'])) {
937 937
                         $results[$uri]['top'] = $results[$uri]['tops'][0];
938 938
                     }
939 939
                 } else {
@@ -1111,7 +1111,7 @@  discard block
 block discarded – undo
1111 1111
         $changeList = $request->getVocab()->getChangeList($prop, $request->getLang(), $offset, $limit);
1112 1112
 
1113 1113
         $simpleChangeList = array();
1114
-        foreach($changeList as $conceptInfo) {
1114
+        foreach ($changeList as $conceptInfo) {
1115 1115
             if (array_key_exists('date', $conceptInfo)) {
1116 1116
                 $concept = array(
1117 1117
                     'uri' => $conceptInfo['uri'],
@@ -1127,10 +1127,10 @@  discard block
 block discarded – undo
1127 1127
             }
1128 1128
         }
1129 1129
         return $this->returnJson(array_merge_recursive($this->context,
1130
-                                                        array('@context' => array( '@language' => $request->getLang(),
1130
+                                                        array('@context' => array('@language' => $request->getLang(),
1131 1131
                                                                                      'prefLabel' => 'skos:prefLabel',
1132 1132
                                                                                      'xsd' => 'http://www.w3.org/2001/XMLSchema#',
1133
-                                                                                     'date' => array( '@id' => 'http://purl.org/dc/terms/date', '@type' => 'http://www.w3.org/2001/XMLSchema#dateTime') )
1133
+                                                                                     'date' => array('@id' => 'http://purl.org/dc/terms/date', '@type' => 'http://www.w3.org/2001/XMLSchema#dateTime'))
1134 1134
                                                         ),
1135 1135
                                                         array('changeList' => $simpleChangeList)));
1136 1136
 
Please login to merge, or discard this patch.