Passed
Push — concept-property-label-overrid... ( 235ebc )
by
unknown
05:19
created
src/model/LabelSkosXL.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
     {
12 12
         $label = null;
13 13
         $labels = $this->resource->allResources('skosxl:prefLabel');
14
-        foreach($labels as $labres) {
14
+        foreach ($labels as $labres) {
15 15
             $label = $labres->getLiteral('skosxl:literalForm');
16 16
             if ($label->getLang() == $this->clang) {
17 17
                 return $label;
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     {
25 25
         $ret = array();
26 26
         $props = $this->resource->properties();
27
-        foreach($props as $prop) {
27
+        foreach ($props as $prop) {
28 28
             if ($prop !== 'rdf:type' && $prop !== 'skosxl:literalForm') {
29 29
                 // make sure to use the correct gettext keys for DC namespace
30 30
                 $propkey = str_starts_with($prop, 'dc11:') ?
Please login to merge, or discard this patch.
src/model/Request.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 
170 170
     public function getRequestUri()
171 171
     {
172
-        return $this->getServerConstant('HTTP_HOST') . $this->getServerConstant('REQUEST_URI');
172
+        return $this->getServerConstant('HTTP_HOST').$this->getServerConstant('REQUEST_URI');
173 173
     }
174 174
 
175 175
     /**
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
      * @param string $newlang new UI language to set
178 178
      * @return string the relative url of the page
179 179
      */
180
-    public function getLangUrl($newlang=null)
180
+    public function getLangUrl($newlang = null)
181 181
     {
182 182
         $script_name = str_replace('/index.php', '', $this->getServerConstant('SCRIPT_NAME'));
183 183
         $langurl = substr(str_replace($script_name, '', strval($this->getServerConstant('REQUEST_URI'))), 1);
Please login to merge, or discard this patch.
src/model/resolver/LOCResource.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
             $opts = array('http' => array('method'=>'HEAD',
14 14
                                           'user_agent' => 'Skosmos',
15 15
                                           'timeout' => $timeout));
16
-            $context  = stream_context_create($opts);
16
+            $context = stream_context_create($opts);
17 17
             $fd = fopen($this->uri, 'rb', false, $context);
18 18
             $headers = stream_get_meta_data($fd)['wrapper_data'];
19 19
             foreach ($headers as $header) {
Please login to merge, or discard this patch.
src/model/PluginRegister.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
     private $requestedPlugins;
6 6
     private $pluginOrder;
7 7
 
8
-    public function __construct($requestedPlugins=array())
8
+    public function __construct($requestedPlugins = array())
9 9
     {
10 10
         $this->requestedPlugins = $requestedPlugins;
11 11
         $this->pluginOrder = array();
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      * @param boolean $raw interpret $type values as raw text instead of files
50 50
      * @return array
51 51
      */
52
-    private function filterPlugins($type, $raw=false)
52
+    private function filterPlugins($type, $raw = false)
53 53
     {
54 54
         $plugins = $this->getPlugins();
55 55
         $plugins = $this->sortPlugins($plugins);
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
                         $ret[$name] = $files[$type];
63 63
                     } else {
64 64
                         foreach ($files[$type] as $file) {
65
-                            array_push($ret[$name], 'plugins/' . $name . '/' . $file);
65
+                            array_push($ret[$name], 'plugins/'.$name.'/'.$file);
66 66
                         }
67 67
                     }
68 68
                 }
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      * @param array $names the plugin name strings (foldernames) in an array
95 95
      * @return array
96 96
      */
97
-    public function getPluginsJS($names=null)
97
+    public function getPluginsJS($names = null)
98 98
     {
99 99
         if ($names) {
100 100
             $names = array_merge($this->requestedPlugins, $names);
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      * @param array $names the plugin name strings (foldernames) in an array
109 109
      * @return array
110 110
      */
111
-    public function getPluginsCSS($names=null)
111
+    public function getPluginsCSS($names = null)
112 112
     {
113 113
         if ($names) {
114 114
             $names = array_merge($this->requestedPlugins, $names);
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      * @param array $names the plugin name strings (foldernames) in an array
123 123
      * @return array
124 124
      */
125
-    public function getPluginsTemplates($names=null)
125
+    public function getPluginsTemplates($names = null)
126 126
     {
127 127
         if ($names) {
128 128
             $names = array_merge($this->requestedPlugins, $names);
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      * @param array $names the plugin name strings (foldernames) in an array
137 137
      * @return array
138 138
      */
139
-    public function getTemplates($names=null)
139
+    public function getTemplates($names = null)
140 140
     {
141 141
         $templateStrings = array();
142 142
         $plugins = $this->getPluginsTemplates($names);
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
             foreach ($templates as $path) {
145 145
                 if (file_exists($path)) {
146 146
                     $filename = explode('/', $path);
147
-                    $filename = $filename[sizeof($filename)-1];
148
-                    $id = $folder . '-' . substr($filename, 0, (strrpos($filename, ".")));
147
+                    $filename = $filename[sizeof($filename) - 1];
148
+                    $id = $folder.'-'.substr($filename, 0, (strrpos($filename, ".")));
149 149
                     $templateStrings[$id] = file_get_contents($path);
150 150
                 }
151 151
             }
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
      * @param array $names the plugin name strings (foldernames) in an array
159 159
      * @return array
160 160
      */
161
-    public function getPluginCallbacks($names=null)
161
+    public function getPluginCallbacks($names = null)
162 162
     {
163 163
         if ($names) {
164 164
             $names = array_merge($this->requestedPlugins, $names);
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
     protected function flatten($array)
200 200
     {
201 201
         $return = array();
202
-        array_walk_recursive($array, function ($a) use (&$return) { $return[] = $a; });
202
+        array_walk_recursive($array, function($a) use (&$return) { $return[] = $a; });
203 203
         return $return;
204 204
     }
205 205
 
Please login to merge, or discard this patch.
src/model/Cache.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
     /**
20 20
      * Wraps apc_store() and apcu_store()
21 21
      */
22
-    public function store($key, $value, $ttl=3600)
22
+    public function store($key, $value, $ttl = 3600)
23 23
     {
24 24
         if (function_exists('apcu_store')) {
25 25
             return apcu_store($key, $value, $ttl);
Please login to merge, or discard this patch.
src/controller/Honeypot.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -33,16 +33,16 @@
 block discarded – undo
33 33
         // Encrypt the current time
34 34
         $honey_time_encrypted = $this->getEncryptedTime();
35 35
         return '<div id="' . $honey_name . '_wrap" style="display:none;">' . "\r\n" .
36
-               '<input name="' . $honey_name . '" type="text" value="" id="' . $honey_name . '"/>' . "\r\n" .
37
-               '<input name="' . $honey_time . '" type="text" value="' . $honey_time_encrypted . '"/>' . "\r\n" .
36
+                '<input name="' . $honey_name . '" type="text" value="" id="' . $honey_name . '"/>' . "\r\n" .
37
+                '<input name="' . $honey_time . '" type="text" value="' . $honey_time_encrypted . '"/>' . "\r\n" .
38 38
                 '</div>';
39 39
     }
40 40
     /**
41
-    * Validate honeypot is empty
42
-    *
43
-    * @param  mixed $value
44
-    * @return boolean
45
-    */
41
+     * Validate honeypot is empty
42
+     *
43
+     * @param  mixed $value
44
+     * @return boolean
45
+     */
46 46
     public function validateHoneypot($value): bool
47 47
     {
48 48
         if ($this->disabled) {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@
 block discarded – undo
32 32
     {
33 33
         // Encrypt the current time
34 34
         $honey_time_encrypted = $this->getEncryptedTime();
35
-        return '<div id="' . $honey_name . '_wrap" style="display:none;">' . "\r\n" .
36
-               '<input name="' . $honey_name . '" type="text" value="" id="' . $honey_name . '"/>' . "\r\n" .
37
-               '<input name="' . $honey_time . '" type="text" value="' . $honey_time_encrypted . '"/>' . "\r\n" .
35
+        return '<div id="'.$honey_name.'_wrap" style="display:none;">'."\r\n".
36
+               '<input name="'.$honey_name.'" type="text" value="" id="'.$honey_name.'"/>'."\r\n".
37
+               '<input name="'.$honey_time.'" type="text" value="'.$honey_time_encrypted.'"/>'."\r\n".
38 38
                 '</div>';
39 39
     }
40 40
     /**
Please login to merge, or discard this patch.
src/controller/Controller.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -156,18 +156,18 @@  discard block
 block discarded – undo
156 156
         $localname = $vocab->getLocalName($uri);
157 157
         if ($localname !== $uri && $localname === urlencode($localname)) {
158 158
             // check that the prefix stripping worked, and there are no problematic chars in localname
159
-            $paramstr = count($params) > 0 ? '?' . http_build_query($params) : '';
159
+            $paramstr = count($params) > 0 ? '?'.http_build_query($params) : '';
160 160
             if ($type && $type !== '' && $type !== 'vocab' && !($localname === '' && $type === 'page')) {
161
-                return "$vocid/$lang/$type/$localname" . $paramstr;
161
+                return "$vocid/$lang/$type/$localname".$paramstr;
162 162
             }
163 163
 
164
-            return "$vocid/$lang/$localname" . $paramstr;
164
+            return "$vocid/$lang/$localname".$paramstr;
165 165
         }
166 166
 
167 167
         // case 2: URI outside vocabulary namespace, or has problematic chars
168 168
         // pass the full URI as parameter instead
169 169
         $params['uri'] = $uri;
170
-        return "$vocid/$lang/$type/?" . http_build_query($params);
170
+        return "$vocid/$lang/$type/?".http_build_query($params);
171 171
     }
172 172
 
173 173
     /**
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
     {
294 294
         if ($modifiedDate) {
295 295
             $ifModifiedSince = $this->getIfModifiedSince();
296
-            $this->sendHeader("Last-Modified: " . $modifiedDate->format('D, d M Y H:i:s \G\M\T'));
296
+            $this->sendHeader("Last-Modified: ".$modifiedDate->format('D, d M Y H:i:s \G\M\T'));
297 297
             if ($ifModifiedSince !== null && $ifModifiedSince >= $modifiedDate) {
298 298
                 $this->sendHeader("HTTP/1.0 304 Not Modified");
299 299
                 return true;
Please login to merge, or discard this patch.
src/controller/EntityController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
         $baseurl = $this->getBaseHref();
17 17
         $vocid = $vocab->getId();
18 18
         $query = http_build_query(array('uri'=>$uri, 'format'=>$targetFormat));
19
-        $url = $baseurl . "rest/v1/$vocid/data?$query";
19
+        $url = $baseurl."rest/v1/$vocid/data?$query";
20 20
         $this->redirect303($url);
21 21
     }
22 22
 
@@ -27,16 +27,16 @@  discard block
 block discarded – undo
27 27
         $localname = $vocab->getLocalName($uri);
28 28
 
29 29
         if (!$localname) {
30
-            $url = $baseurl . "$vocid/";
30
+            $url = $baseurl."$vocid/";
31 31
         } else {
32 32
 
33 33
             if ($localname !== $uri && $localname === urlencode($localname)) {
34 34
                 // the URI can be shortened
35
-                $url = $baseurl . "$vocid/page/$localname";
35
+                $url = $baseurl."$vocid/page/$localname";
36 36
             } else {
37 37
                 // must use full URI
38 38
                 $query = http_build_query(array('uri'=>$uri));
39
-                $url = $baseurl . "$vocid/page/?" . $query;
39
+                $url = $baseurl."$vocid/page/?".$query;
40 40
             }
41 41
         }
42 42
         $this->redirect303($url);
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
             // guess vocabulary based on URI
59 59
             $vocab = $this->model->guessVocabularyFromURI($request->getUri());
60 60
             if ($vocab === null) {
61
-                return $this->returnError('404', 'Not Found', 'Unrecognized URI ' . $request->getUri());
61
+                return $this->returnError('404', 'Not Found', 'Unrecognized URI '.$request->getUri());
62 62
             }
63 63
             $request->setVocab($vocab->getId());
64 64
         }
Please login to merge, or discard this patch.
src/controller/RestController.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1165,9 +1165,9 @@
 block discarded – undo
1165 1165
         return $this->returnJson(array_merge_recursive(
1166 1166
             $this->context,
1167 1167
             array('@context' => array( '@language' => $request->getLang(),
1168
-                                                                                     'prefLabel' => 'skos:prefLabel',
1169
-                                                                                     'xsd' => 'http://www.w3.org/2001/XMLSchema#',
1170
-                                                                                     'date' => array( '@id' => 'http://purl.org/dc/terms/date', '@type' => 'http://www.w3.org/2001/XMLSchema#dateTime') )
1168
+                                                                                      'prefLabel' => 'skos:prefLabel',
1169
+                                                                                      'xsd' => 'http://www.w3.org/2001/XMLSchema#',
1170
+                                                                                      'date' => array( '@id' => 'http://purl.org/dc/terms/date', '@type' => 'http://www.w3.org/2001/XMLSchema#dateTime') )
1171 1171
                                                         ),
1172 1172
             array('changeList' => $simpleChangeList)
1173 1173
         ));
Please login to merge, or discard this 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) . "(" . json_encode($data) . ");";
28
+            echo filter_input(INPUT_GET, 'callback', FILTER_SANITIZE_FULL_SPECIAL_CHARS)."(".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(
416 416
             $this->context,
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
         if ($lang === null) {
458 458
             // case 1A: exact match on preferred label in any language
459 459
             foreach ($results as $res) {
460
-                if (isset($res['matchedPrefLabel']) && $res['matchedPrefLabel']  == $label) {
460
+                if (isset($res['matchedPrefLabel']) && $res['matchedPrefLabel'] == $label) {
461 461
                     $res['prefLabel'] = $res['matchedPrefLabel'];
462 462
                     unset($res['matchedPrefLabel']);
463 463
                     $hits[] = $res;
@@ -592,19 +592,19 @@  discard block
 block discarded – undo
592 592
 
593 593
         $format = $this->negotiateFormat(array_keys($urls), $request->getServerConstant('HTTP_ACCEPT'), $request->getQueryParam('format'));
594 594
         if (!$format) {
595
-            return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: " . implode(' ', array_keys($urls)));
595
+            return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: ".implode(' ', array_keys($urls)));
596 596
         }
597 597
         if (is_array($urls[$format])) {
598 598
             $arr = $urls[$format];
599 599
             $dataLang = $request->getLang();
600 600
             if (isset($arr[$dataLang])) {
601
-                header("Location: " . $arr[$dataLang]);
601
+                header("Location: ".$arr[$dataLang]);
602 602
             } else {
603 603
                 $vocid = $request->getVocab()->getId();
604 604
                 return $this->returnError('404', 'Not Found', "No download source URL known for vocabulary $vocid in language $dataLang");
605 605
             }
606 606
         } else {
607
-            header("Location: " . $urls[$format]);
607
+            header("Location: ".$urls[$format]);
608 608
         }
609 609
     }
610 610
 
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
 
669 669
         $format = $this->negotiateFormat(explode(' ', self::SUPPORTED_FORMATS), $request->getServerConstant('HTTP_ACCEPT'), $request->getQueryParam('format'));
670 670
         if (!$format) {
671
-            return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: " . self::SUPPORTED_FORMATS);
671
+            return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: ".self::SUPPORTED_FORMATS);
672 672
         }
673 673
 
674 674
         $vocid = $vocab ? $vocab->getId() : null;
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
                         }
962 962
                     }
963 963
                     // if the main concept scheme was not found, set 'top' to the first 'tops' (sorted alphabetically on the URIs)
964
-                    if (! isset($results[$uri]['top'])) {
964
+                    if (!isset($results[$uri]['top'])) {
965 965
                         $results[$uri]['top'] = $results[$uri]['tops'][0];
966 966
                     }
967 967
                 } else {
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
         $changeList = $request->getVocab()->getChangeList($prop, $request->getLang(), $offset, $limit);
1148 1148
 
1149 1149
         $simpleChangeList = array();
1150
-        foreach($changeList as $conceptInfo) {
1150
+        foreach ($changeList as $conceptInfo) {
1151 1151
             if (array_key_exists('date', $conceptInfo)) {
1152 1152
                 $concept = array(
1153 1153
                     'uri' => $conceptInfo['uri'],
@@ -1164,10 +1164,10 @@  discard block
 block discarded – undo
1164 1164
         }
1165 1165
         return $this->returnJson(array_merge_recursive(
1166 1166
             $this->context,
1167
-            array('@context' => array( '@language' => $request->getLang(),
1167
+            array('@context' => array('@language' => $request->getLang(),
1168 1168
                                                                                      'prefLabel' => 'skos:prefLabel',
1169 1169
                                                                                      'xsd' => 'http://www.w3.org/2001/XMLSchema#',
1170
-                                                                                     'date' => array( '@id' => 'http://purl.org/dc/terms/date', '@type' => 'http://www.w3.org/2001/XMLSchema#dateTime') )
1170
+                                                                                     'date' => array('@id' => 'http://purl.org/dc/terms/date', '@type' => 'http://www.w3.org/2001/XMLSchema#dateTime'))
1171 1171
                                                         ),
1172 1172
             array('changeList' => $simpleChangeList)
1173 1173
         ));
Please login to merge, or discard this patch.