Completed
Push — master ( 7027b0...ba9ef8 )
by Osma
01:59 queued 11s
created
controller/RestController.php 1 patch
Spacing   +22 added lines, -22 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);
@@ -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
             }
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
         if ($request->getQueryParam('labellang')) {
161 161
             $ret['@context']['@language'] = $request->getQueryParam('labellang');
162 162
         } elseif ($request->getQueryParam('lang')) {
163
-            $ret['@context']['@language'] = $request->getQueryParam('lang');;
163
+            $ret['@context']['@language'] = $request->getQueryParam('lang'); ;
164 164
         }
165 165
         return $ret;
166 166
     }
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
                 'prefLabel' => 'skos:prefLabel',
230 230
                 'title' => 'dct:title',
231 231
                 '@language' => $request->getLang(),
232
-                '@base' => $this->getBaseHref() . "rest/v1/" . $vocab->getId() . "/",
232
+                '@base' => $this->getBaseHref()."rest/v1/".$vocab->getId()."/",
233 233
             ),
234 234
             'uri' => '',
235 235
             'id' => $vocab->getId(),
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
                 'subTypes' => array('@id' => 'void:class', '@type' => '@id'),
284 284
                 'count' => 'void:entities',
285 285
                 '@language' => $request->getLang(),
286
-                '@base' => $this->getBaseHref() . "rest/v1/" . $request->getVocab()->getId() . "/",
286
+                '@base' => $this->getBaseHref()."rest/v1/".$request->getVocab()->getId()."/",
287 287
             ),
288 288
             'uri' => '',
289 289
             'id' => $request->getVocab()->getId(),
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
                 'language' => 'void-ext:language',
361 361
                 'properties' => 'void:propertyPartition',
362 362
                 'labels' => 'void:triples',
363
-                '@base' => $this->getBaseHref() . "rest/v1/" . $request->getVocab()->getId() . "/",
363
+                '@base' => $this->getBaseHref()."rest/v1/".$request->getVocab()->getId()."/",
364 364
             ),
365 365
             'uri' => '',
366 366
             'id' => $request->getVocab()->getId(),
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
             $types[] = $type;
402 402
         }
403 403
 
404
-        $base = $request->getVocab() ? $this->getBaseHref() . "rest/v1/" . $request->getVocab()->getId() . "/" : $this->getBaseHref() . "rest/v1/";
404
+        $base = $request->getVocab() ? $this->getBaseHref()."rest/v1/".$request->getVocab()->getId()."/" : $this->getBaseHref()."rest/v1/";
405 405
 
406 406
         $ret = array_merge_recursive($this->context, array(
407 407
             '@context' => array(
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
         if ($lang === null) {
443 443
             // case 1A: exact match on preferred label in any language
444 444
             foreach ($results as $res) {
445
-                if (isset($res['matchedPrefLabel']) && $res['matchedPrefLabel']  == $label) {
445
+                if (isset($res['matchedPrefLabel']) && $res['matchedPrefLabel'] == $label) {
446 446
                     $res['prefLabel'] = $res['matchedPrefLabel'];
447 447
                     unset($res['matchedPrefLabel']);
448 448
                     $hits[] = $res;
@@ -564,19 +564,19 @@  discard block
 block discarded – undo
564 564
 
565 565
         $format = $this->negotiateFormat(array_keys($urls), $request->getServerConstant('HTTP_ACCEPT'), $request->getQueryParam('format'));
566 566
         if (!$format) {
567
-            return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: " . implode(' ', array_keys($urls)));
567
+            return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: ".implode(' ', array_keys($urls)));
568 568
         }
569 569
         if (is_array($urls[$format])) {
570 570
             $arr = $urls[$format];
571 571
             $dataLang = $request->getLang();
572 572
             if (isset($arr[$dataLang])) {
573
-                header("Location: " . $arr[$dataLang]);
573
+                header("Location: ".$arr[$dataLang]);
574 574
             } else {
575 575
                 $vocid = $request->getVocab()->getId();
576 576
                 return $this->returnError('404', 'Not Found', "No download source URL known for vocabulary $vocid in language $dataLang");
577 577
             }
578 578
 		} else {
579
-            header("Location: " . $urls[$format]);
579
+            header("Location: ".$urls[$format]);
580 580
 		}
581 581
     }
582 582
 
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
 
640 640
         $format = $this->negotiateFormat(explode(' ', self::SUPPORTED_FORMATS), $request->getServerConstant('HTTP_ACCEPT'), $request->getQueryParam('format'));
641 641
         if (!$format) {
642
-            return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: " . self::SUPPORTED_FORMATS);
642
+            return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: ".self::SUPPORTED_FORMATS);
643 643
         }
644 644
 
645 645
         $vocid = $vocab ? $vocab->getId() : null;
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
                         }
925 925
                     }
926 926
                     // if the main concept scheme was not found, set 'top' to the first 'tops' (sorted alphabetically on the URIs)
927
-                    if (! isset($results[$uri]['top'])) {
927
+                    if (!isset($results[$uri]['top'])) {
928 928
                         $results[$uri]['top'] = $results[$uri]['tops'][0];
929 929
                     }
930 930
                 } else {
@@ -1102,18 +1102,18 @@  discard block
 block discarded – undo
1102 1102
         $changeList = $request->getVocab()->getChangeList($prop, $request->getLang(), $offset, $limit);
1103 1103
 
1104 1104
         $simpleChangeList = array();
1105
-        foreach($changeList as $conceptInfo) {
1105
+        foreach ($changeList as $conceptInfo) {
1106 1106
             if (array_key_exists('date', $conceptInfo)) {
1107
-                $simpleChangeList[] =  array( 'uri' => $conceptInfo['uri'],
1107
+                $simpleChangeList[] = array('uri' => $conceptInfo['uri'],
1108 1108
                                                'prefLabel' => $conceptInfo['prefLabel'],
1109
-                                               'date' => $conceptInfo['date']->format("Y-m-d\TH:i:sO") );
1109
+                                               'date' => $conceptInfo['date']->format("Y-m-d\TH:i:sO"));
1110 1110
             }
1111 1111
         }
1112 1112
         return $this->returnJson(array_merge_recursive($this->context,
1113
-                                                        array('@context' => array( '@language' => $request->getLang(),
1113
+                                                        array('@context' => array('@language' => $request->getLang(),
1114 1114
                                                                                      'prefLabel' => 'skos:prefLabel',
1115 1115
                                                                                      'xsd' => 'http://www.w3.org/2001/XMLSchema#',
1116
-                                                                                     'date' => array( '@id' => 'http://purl.org/dc/terms/date', '@type' => 'http://www.w3.org/2001/XMLSchema#dateTime') )
1116
+                                                                                     'date' => array('@id' => 'http://purl.org/dc/terms/date', '@type' => 'http://www.w3.org/2001/XMLSchema#dateTime'))
1117 1117
                                                         ),
1118 1118
                                                         array('changeList' => $simpleChangeList)));
1119 1119
 
Please login to merge, or discard this patch.