Passed
Pull Request — master (#1354)
by
unknown
04:04
created
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.
model/ConceptProperty.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      * @param string $super URI of superproperty
28 28
      * @param boolean $sort_by_notation whether to sort the property values by their notation code
29 29
      */
30
-    public function __construct($prop, $label, $tooltip=null, $super=null, $sort_by_notation=false)
30
+    public function __construct($prop, $label, $tooltip = null, $super = null, $sort_by_notation = false)
31 31
     {
32 32
         $this->prop = $prop;
33 33
         $this->label = $label;
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      */
68 68
     public function getDescription()
69 69
     {
70
-        $helpprop = $this->prop . "_help";
70
+        $helpprop = $this->prop."_help";
71 71
 
72 72
         // see if we have a translation with the help text
73 73
         $help = gettext($helpprop);
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
     public function addValue($value)
100 100
     {
101
-        $this->values[ltrim($value->getNotation() . ' ') . $value->getLabel() . rtrim(' ' . $value->getUri())] = $value;
101
+        $this->values[ltrim($value->getNotation().' ').$value->getLabel().rtrim(' '.$value->getUri())] = $value;
102 102
         $this->is_sorted = false;
103 103
     }
104 104
 
Please login to merge, or discard this patch.
model/ConceptMappingPropertyValue.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     {
37 37
         $label = $this->getLabel();
38 38
         $notation = $this->getNotation();
39
-        return ltrim($notation . ' ') . $label;
39
+        return ltrim($notation.' ').$label;
40 40
     }
41 41
 
42 42
     public function getType()
@@ -180,25 +180,25 @@  discard block
 block discarded – undo
180 180
             'from' => [
181 181
                 'memberSet' => [
182 182
                     [
183
-                        'uri' => (string) $this->source->getUri(),
183
+                        'uri' => (string)$this->source->getUri(),
184 184
                     ]
185 185
                 ]
186 186
             ],
187 187
             'to' => [
188 188
                 'memberSet' => [
189 189
                     [
190
-                        'uri' => (string) $this->getUri()
190
+                        'uri' => (string)$this->getUri()
191 191
                     ]
192 192
                 ]
193 193
             ],
194 194
             // EXTRA
195 195
             'hrefLink' => $hrefLink, // link to resource as displayed in the UI
196 196
             'lang' => $propertyLang, // TBD: could it be part of the prefLabel?
197
-            'vocabName' => (string) $this->getVocabName(), // vocabulary as displayed in the UI
197
+            'vocabName' => (string)$this->getVocabName(), // vocabulary as displayed in the UI
198 198
             'typeLabel' => gettext($this->type), // a text used in the UI instead of, for example, skos:closeMatch
199 199
         ];
200 200
 
201
-        $helpprop = $this->type . "_help";
201
+        $helpprop = $this->type."_help";
202 202
         // see if we have a translation for the property help text
203 203
         $help = gettext($helpprop);
204 204
         if ($help != $helpprop) {
@@ -208,20 +208,20 @@  discard block
 block discarded – undo
208 208
         $fromScheme = $this->vocab->getDefaultConceptScheme();
209 209
         if (isset($fromScheme)) {
210 210
             $ret['fromScheme'] = [
211
-                'uri' => (string) $fromScheme,
211
+                'uri' => (string)$fromScheme,
212 212
             ];
213 213
         }
214 214
 
215 215
         $exvocab = $this->getExvocab();
216 216
         if (isset($exvocab)) {
217 217
             $ret['toScheme'] = [
218
-                'uri' => (string) $exvocab->getDefaultConceptScheme(),
218
+                'uri' => (string)$exvocab->getDefaultConceptScheme(),
219 219
             ];
220 220
         }
221 221
 
222 222
         $notation = $this->getNotation();
223 223
         if (isset($notation)) {
224
-            $ret['to']['memberSet'][0]['notation'] = (string) $notation;
224
+            $ret['to']['memberSet'][0]['notation'] = (string)$notation;
225 225
         }
226 226
 
227 227
         $label = $this->getLabel($lang, $queryExVocabs);
Please login to merge, or discard this patch.
controller/Honeypot.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@  discard block
 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
     /**
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         // Get the decrypted time
67 67
         $value = $this->decryptTime($value);
68 68
         // The current time should be greater than the time the form was built + minimum
69
-        return ( is_numeric($value) && time() > ($value + $minDelta) );
69
+        return (is_numeric($value) && time() > ($value + $minDelta));
70 70
     }
71 71
     /**
72 72
      * Get encrypted time
Please login to merge, or discard this patch.
model/BaseConfig.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
      * @param string $lang preferred language for the literal
45 45
      * @return string string value for the given property, or the default value if not found
46 46
      */
47
-    protected function getLiteral($property, $default=null, $lang=null)
47
+    protected function getLiteral($property, $default = null, $lang = null)
48 48
     {
49 49
         if (!isset($lang)) {
50 50
             $lang = $this->getEnvLang();
Please login to merge, or discard this patch.
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_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
             }
@@ -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(),
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
                 'subTypes' => array('@id' => 'void:class', '@type' => '@id'),
285 285
                 'count' => 'void:entities',
286 286
                 '@language' => $request->getLang(),
287
-                '@base' => $this->getBaseHref() . "rest/v1/" . $request->getVocab()->getId() . "/",
287
+                '@base' => $this->getBaseHref()."rest/v1/".$request->getVocab()->getId()."/",
288 288
             ),
289 289
             'uri' => '',
290 290
             'id' => $request->getVocab()->getId(),
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
                 'language' => 'void-ext:language',
367 367
                 'properties' => 'void:propertyPartition',
368 368
                 'labels' => 'void:triples',
369
-                '@base' => $this->getBaseHref() . "rest/v1/" . $request->getVocab()->getId() . "/",
369
+                '@base' => $this->getBaseHref()."rest/v1/".$request->getVocab()->getId()."/",
370 370
             ),
371 371
             'uri' => '',
372 372
             'id' => $request->getVocab()->getId(),
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
             $types[] = $type;
408 408
         }
409 409
 
410
-        $base = $request->getVocab() ? $this->getBaseHref() . "rest/v1/" . $request->getVocab()->getId() . "/" : $this->getBaseHref() . "rest/v1/";
410
+        $base = $request->getVocab() ? $this->getBaseHref()."rest/v1/".$request->getVocab()->getId()."/" : $this->getBaseHref()."rest/v1/";
411 411
 
412 412
         $ret = array_merge_recursive($this->context, array(
413 413
             '@context' => array(
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
         if ($lang === null) {
449 449
             // case 1A: exact match on preferred label in any language
450 450
             foreach ($results as $res) {
451
-                if (isset($res['matchedPrefLabel']) && $res['matchedPrefLabel']  == $label) {
451
+                if (isset($res['matchedPrefLabel']) && $res['matchedPrefLabel'] == $label) {
452 452
                     $res['prefLabel'] = $res['matchedPrefLabel'];
453 453
                     unset($res['matchedPrefLabel']);
454 454
                     $hits[] = $res;
@@ -570,19 +570,19 @@  discard block
 block discarded – undo
570 570
 
571 571
         $format = $this->negotiateFormat(array_keys($urls), $request->getServerConstant('HTTP_ACCEPT'), $request->getQueryParam('format'));
572 572
         if (!$format) {
573
-            return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: " . implode(' ', array_keys($urls)));
573
+            return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: ".implode(' ', array_keys($urls)));
574 574
         }
575 575
         if (is_array($urls[$format])) {
576 576
             $arr = $urls[$format];
577 577
             $dataLang = $request->getLang();
578 578
             if (isset($arr[$dataLang])) {
579
-                header("Location: " . $arr[$dataLang]);
579
+                header("Location: ".$arr[$dataLang]);
580 580
             } else {
581 581
                 $vocid = $request->getVocab()->getId();
582 582
                 return $this->returnError('404', 'Not Found', "No download source URL known for vocabulary $vocid in language $dataLang");
583 583
             }
584 584
 		} else {
585
-            header("Location: " . $urls[$format]);
585
+            header("Location: ".$urls[$format]);
586 586
 		}
587 587
     }
588 588
 
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
 
646 646
         $format = $this->negotiateFormat(explode(' ', self::SUPPORTED_FORMATS), $request->getServerConstant('HTTP_ACCEPT'), $request->getQueryParam('format'));
647 647
         if (!$format) {
648
-            return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: " . self::SUPPORTED_FORMATS);
648
+            return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: ".self::SUPPORTED_FORMATS);
649 649
         }
650 650
 
651 651
         $vocid = $vocab ? $vocab->getId() : null;
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
                         }
931 931
                     }
932 932
                     // if the main concept scheme was not found, set 'top' to the first 'tops' (sorted alphabetically on the URIs)
933
-                    if (! isset($results[$uri]['top'])) {
933
+                    if (!isset($results[$uri]['top'])) {
934 934
                         $results[$uri]['top'] = $results[$uri]['tops'][0];
935 935
                     }
936 936
                 } else {
@@ -1108,7 +1108,7 @@  discard block
 block discarded – undo
1108 1108
         $changeList = $request->getVocab()->getChangeList($prop, $request->getLang(), $offset, $limit);
1109 1109
 
1110 1110
         $simpleChangeList = array();
1111
-        foreach($changeList as $conceptInfo) {
1111
+        foreach ($changeList as $conceptInfo) {
1112 1112
             if (array_key_exists('date', $conceptInfo)) {
1113 1113
                 $concept = array(
1114 1114
                     'uri' => $conceptInfo['uri'],
@@ -1124,10 +1124,10 @@  discard block
 block discarded – undo
1124 1124
             }
1125 1125
         }
1126 1126
         return $this->returnJson(array_merge_recursive($this->context,
1127
-                                                        array('@context' => array( '@language' => $request->getLang(),
1127
+                                                        array('@context' => array('@language' => $request->getLang(),
1128 1128
                                                                                      'prefLabel' => 'skos:prefLabel',
1129 1129
                                                                                      'xsd' => 'http://www.w3.org/2001/XMLSchema#',
1130
-                                                                                     'date' => array( '@id' => 'http://purl.org/dc/terms/date', '@type' => 'http://www.w3.org/2001/XMLSchema#dateTime') )
1130
+                                                                                     'date' => array('@id' => 'http://purl.org/dc/terms/date', '@type' => 'http://www.w3.org/2001/XMLSchema#dateTime'))
1131 1131
                                                         ),
1132 1132
                                                         array('changeList' => $simpleChangeList)));
1133 1133
 
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
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         // specify where to look for templates and cache
38 38
         $loader = new Twig_Loader_Filesystem('view');
39 39
         // initialize Twig environment
40
-        $this->twig = new Twig_Environment($loader, array('cache' => $tmpDir,'auto_reload' => true));
40
+        $this->twig = new Twig_Environment($loader, array('cache' => $tmpDir, 'auto_reload' => true));
41 41
         $this->twig->addExtension(new Twig_Extensions_Extension_I18n());
42 42
         // used for setting the base href for the relative urls
43 43
         $this->twig->addGlobal("BaseHref", $this->getBaseHref());
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         $this->twig->addFilter(new Twig_SimpleFilter('link_url', array($this, 'linkUrlFilter')));
61 61
 
62 62
         // register a Twig filter for generating strings from language codes with CLDR
63
-        $langFilter = new Twig_SimpleFilter('lang_name', function ($langcode, $lang) {
63
+        $langFilter = new Twig_SimpleFilter('lang_name', function($langcode, $lang) {
64 64
             return Language::getName($langcode, $lang);
65 65
         });
66 66
         $this->twig->addFilter($langFilter);
@@ -234,16 +234,16 @@  discard block
 block discarded – undo
234 234
 
235 235
     private function createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender)
236 236
     {
237
-        $headers = "MIME-Version: 1.0" . "\r\n";
238
-        $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";
237
+        $headers = "MIME-Version: 1.0"."\r\n";
238
+        $headers .= "Content-type: text/html; charset=UTF-8"."\r\n";
239 239
         if (!empty($toMail)) {
240
-            $headers .= "Cc: " . $this->model->getConfig()->getFeedbackAddress() . "\r\n";
240
+            $headers .= "Cc: ".$this->model->getConfig()->getFeedbackAddress()."\r\n";
241 241
         }
242 242
         if (!empty($fromEmail)) {
243 243
             $headers .= "Reply-To: $fromName <$fromEmail>\r\n";
244 244
         }
245 245
         $service = $this->model->getConfig()->getServiceName();
246
-        return $headers . "From: $fromName via $service <$sender>";
246
+        return $headers."From: $fromName via $service <$sender>";
247 247
     }
248 248
 
249 249
     /**
@@ -257,9 +257,9 @@  discard block
 block discarded – undo
257 257
     public function sendFeedback($request, $message, $messageSubject, $fromName = null, $fromEmail = null, $fromVocab = null, $toMail = null)
258 258
     {
259 259
         $toAddress = ($toMail) ? $toMail : $this->model->getConfig()->getFeedbackAddress();
260
-        $messageSubject = "[" . $this->model->getConfig()->getServiceName() . "] " . $messageSubject;
260
+        $messageSubject = "[".$this->model->getConfig()->getServiceName()."] ".$messageSubject;
261 261
         if ($fromVocab !== null && $fromVocab !== '') {
262
-            $message = 'Feedback from vocab: ' . strtoupper($fromVocab) . "<br />" . $message;
262
+            $message = 'Feedback from vocab: '.strtoupper($fromVocab)."<br />".$message;
263 263
         }
264 264
         $envelopeSender = $this->model->getConfig()->getFeedbackEnvelopeSender();
265 265
         // determine the sender address of the message
@@ -272,10 +272,10 @@  discard block
 block discarded – undo
272 272
         $headers = $this->createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender);
273 273
         $params = empty($envelopeSender) ? '' : "-f $envelopeSender";
274 274
         // adding some information about the user for debugging purposes.
275
-        $message = $message . "<br /><br /> Debugging information:"
276
-            . "<br />Timestamp: " . date(DATE_RFC2822)
277
-            . "<br />User agent: " . $request->getServerConstant('HTTP_USER_AGENT')
278
-            . "<br />Referer: " . $request->getServerConstant('HTTP_REFERER');
275
+        $message = $message."<br /><br /> Debugging information:"
276
+            . "<br />Timestamp: ".date(DATE_RFC2822)
277
+            . "<br />User agent: ".$request->getServerConstant('HTTP_USER_AGENT')
278
+            . "<br />Referer: ".$request->getServerConstant('HTTP_REFERER');
279 279
 
280 280
         try {
281 281
             mail($toAddress, $messageSubject, $message, $headers, $params);
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
             header("HTTP/1.0 404 Not Found");
284 284
             $template = $this->twig->loadTemplate('error-page.twig');
285 285
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
286
-                error_log('Caught exception: ' . $e->getMessage());
286
+                error_log('Caught exception: '.$e->getMessage());
287 287
             }
288 288
 
289 289
             echo $template->render(
@@ -328,13 +328,13 @@  discard block
 block discarded – undo
328 328
         $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : null;
329 329
         $vocabObjects = array();
330 330
         if ($vocids) {
331
-            foreach($vocids as $vocid) {
331
+            foreach ($vocids as $vocid) {
332 332
                 try {
333 333
                     $vocabObjects[] = $this->model->getVocabulary($vocid);
334 334
                 } catch (ValueError $e) {
335 335
                     // fail fast with an error page if the vocabulary cannot be found
336 336
                     if ($this->model->getConfig()->getLogCaughtExceptions()) {
337
-                        error_log('Caught exception: ' . $e->getMessage());
337
+                        error_log('Caught exception: '.$e->getMessage());
338 338
                     }
339 339
                     header("HTTP/1.0 400 Bad Request");
340 340
                     $this->invokeGenericErrorPage($request, $e->getMessage());
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
             $errored = true;
357 357
             header("HTTP/1.0 500 Internal Server Error");
358 358
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
359
-                error_log('Caught exception: ' . $e->getMessage());
359
+                error_log('Caught exception: '.$e->getMessage());
360 360
             }
361 361
         }
362 362
         $vocabList = $this->model->getVocabularyList();
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
                 'search_count' => $counts,
369 369
                 'languages' => $this->languages,
370 370
                 'search_results' => $searchResults,
371
-                'rest' => $parameters->getOffset()>0,
371
+                'rest' => $parameters->getOffset() > 0,
372 372
                 'global_search' => true,
373 373
                 'search_failed' => $errored,
374 374
                 'term' => $request->getQueryParamRaw('q'),
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
         } catch (Exception $e) {
396 396
             header("HTTP/1.0 500 Internal Server Error");
397 397
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
398
-                error_log('Caught exception: ' . $e->getMessage());
398
+                error_log('Caught exception: '.$e->getMessage());
399 399
             }
400 400
 
401 401
             echo $template->render(
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
         } catch (Exception $e) {
420 420
             header("HTTP/1.0 404 Not Found");
421 421
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
422
-                error_log('Caught exception: ' . $e->getMessage());
422
+                error_log('Caught exception: '.$e->getMessage());
423 423
             }
424 424
 
425 425
             echo $template->render(
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
                 'vocab' => $vocab,
438 438
                 'search_results' => $searchResults,
439 439
                 'search_count' => $counts,
440
-                'rest' => $parameters->getOffset()>0,
440
+                'rest' => $parameters->getOffset() > 0,
441 441
                 'limit_parent' => $parameters->getParentLimit(),
442 442
                 'limit_type' =>  $request->getQueryParam('type') ? explode('+', $request->getQueryParam('type')) : null,
443 443
                 'limit_group' => $parameters->getGroupLimit(),
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
      * Loads and renders the view containing a list of recent changes in the vocabulary.
570 570
      * @param Request $request
571 571
      */
572
-    public function invokeChangeList($request, $prop='dc:created')
572
+    public function invokeChangeList($request, $prop = 'dc:created')
573 573
     {
574 574
         $offset = ($request->getQueryParam('offset') && is_numeric($request->getQueryParam('offset')) && $request->getQueryParam('offset') >= 0) ? $request->getQueryParam('offset') : 0;
575 575
         $limit = ($request->getQueryParam('limit') && is_numeric($request->getQueryParam('limit')) && $request->getQueryParam('limit') >= 0) ? $request->getQueryParam('limit') : 200;
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
      * @param int $limit maximum number of concepts to return
598 598
      * @return Array list of concepts
599 599
      */
600
-    public function getChangeList($request, $prop, $offset=0, $limit=200)
600
+    public function getChangeList($request, $prop, $offset = 0, $limit = 200)
601 601
     {
602 602
         // set language parameters for gettext
603 603
         $this->setLanguageProperties($request->getLang());
@@ -614,9 +614,9 @@  discard block
 block discarded – undo
614 614
     public function formatChangeList($changeList, $lang)
615 615
     {
616 616
         $formatByDate = array();
617
-        foreach($changeList as $concept) {
617
+        foreach ($changeList as $concept) {
618 618
             $concept['datestring'] = Punic\Calendar::formatDate($concept['date'], 'medium', $lang);
619
-            $formatByDate[Punic\Calendar::getMonthName($concept['date'], 'wide', $lang, true) . Punic\Calendar::format($concept['date'], ' y', $lang) ][strtolower($concept['prefLabel'])] = $concept;
619
+            $formatByDate[Punic\Calendar::getMonthName($concept['date'], 'wide', $lang, true).Punic\Calendar::format($concept['date'], ' y', $lang)][strtolower($concept['prefLabel'])] = $concept;
620 620
         }
621 621
         return $formatByDate;
622 622
     }
Please login to merge, or discard this patch.
model/Concept.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -136,9 +136,9 @@  discard block
 block discarded – undo
136 136
                 return $this->resource->label($fallback);
137 137
             }
138 138
             // We need to check all the labels in case one of them matches a subtag of the current language
139
-            foreach($this->resource->allLiterals('skos:prefLabel') as $label) {
139
+            foreach ($this->resource->allLiterals('skos:prefLabel') as $label) {
140 140
                 // the label lang code is a subtag of the UI lang eg. en-GB - create a new literal with the main language
141
-                if ($label !== null && strpos($label->getLang(), $fallback . '-') === 0) {
141
+                if ($label !== null && strpos($label->getLang(), $fallback.'-') === 0) {
142 142
                     return EasyRdf\Literal::create($label, $fallback);
143 143
                 }
144 144
             }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 
160 160
     public function hasXlLabel($prop = 'prefLabel')
161 161
     {
162
-        if ($this->resource->hasProperty('skosxl:' . $prop)) {
162
+        if ($this->resource->hasProperty('skosxl:'.$prop)) {
163 163
             return true;
164 164
         }
165 165
         return false;
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     public function getXlLabel()
169 169
     {
170 170
         $labels = $this->resource->allResources('skosxl:prefLabel');
171
-        foreach($labels as $labres) {
171
+        foreach ($labels as $labres) {
172 172
             $label = $labres->getLiteral('skosxl:literalForm');
173 173
             if ($label !== null && $label->getLang() == $this->clang) {
174 174
                 return new LabelSkosXL($this->model, $labres);
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
         // catch external subjects that have $res as object
276 276
         $extSubjects = $exGraph->resourcesMatching("schema:about", $res);
277 277
 
278
-        $propList =  array_unique(array_merge(
278
+        $propList = array_unique(array_merge(
279 279
             $this->DEFAULT_EXT_PROPERTIES,
280 280
             $this->getVocab()->getConfig()->getExtProperties(),
281 281
             $this->getVocab()->getConfig()->getPluginRegister()->getExtProperties()
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
      * @param string[] $seen Processed resources so far
301 301
      * @param string[] $props (optional) limit to these property URIs
302 302
      */
303
-    private function addExternalTriplesToGraph($res, &$seen, $props=null)
303
+    private function addExternalTriplesToGraph($res, &$seen, $props = null)
304 304
     {
305 305
         if (array_key_exists($res->getUri(), $seen) && $seen[$res->getUri()] === 0) {
306 306
             return;
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
      */
331 331
     private function addPropertyValues($res, $prop, &$seen)
332 332
     {
333
-        $resList = $res->allResources('<' . $prop . '>');
333
+        $resList = $res->allResources('<'.$prop.'>');
334 334
 
335 335
         foreach ($resList as $res2) {
336 336
             if ($res2->isBNode()) {
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
             $this->addResourceReifications($res, $prop, $res2, $seen);
341 341
         }
342 342
 
343
-        $litList = $res->allLiterals('<' . $prop . '>');
343
+        $litList = $res->allLiterals('<'.$prop.'>');
344 344
 
345 345
         foreach ($litList as $lit) {
346 346
             $this->graph->addLiteral($res, $prop, $lit);
@@ -528,15 +528,15 @@  discard block
 block discarded – undo
528 528
                 // if not found in current vocabulary, look up in the default graph to be able
529 529
                 // to read an ontology loaded in a separate graph
530 530
                 // note that this imply that the property has an rdf:type declared for the query to work
531
-                if(!$is_well_known && !$proplabel) {
531
+                if (!$is_well_known && !$proplabel) {
532 532
                     $envLangLabels = $this->model->getDefaultSparql()->queryLabel($longUri, $this->getEnvLang());
533 533
                     
534 534
                     $defaultPropLabel = $this->model->getDefaultSparql()->queryLabel($longUri, '');
535 535
 
536
-					if($envLangLabels) {
536
+					if ($envLangLabels) {
537 537
 						$proplabel = $envLangLabels[$this->getEnvLang()];
538 538
                     } else {
539
-						if($defaultPropLabel) {
539
+						if ($defaultPropLabel) {
540 540
 							$proplabel = $defaultPropLabel[''];
541 541
 						}
542 542
 					}
@@ -549,12 +549,12 @@  discard block
 block discarded – undo
549 549
                 }
550 550
 
551 551
                 // also look up superprops in the default graph if not found in current vocabulary
552
-                if(!$is_well_known && (!$superprops || empty($superprops))) {
552
+                if (!$is_well_known && (!$superprops || empty($superprops))) {
553 553
                     $superprops = $this->model->getDefaultSparql()->querySuperProperties($longUri);
554 554
                 }
555 555
 
556 556
                 // we're reading only one super property, even if there are multiple ones
557
-                $superprop = ($superprops)?$superprops[0]:null;
557
+                $superprop = ($superprops) ? $superprops[0] : null;
558 558
                 if ($superprop) {
559 559
                     $superprop = EasyRdf\RdfNamespace::shorten($superprop) ? EasyRdf\RdfNamespace::shorten($superprop) : $superprop;
560 560
                 }
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
                 }
568 568
 
569 569
                 // searching for subproperties of literals too
570
-                if($superprops) {
570
+                if ($superprops) {
571 571
                     foreach ($superprops as $subi) {
572 572
                         $suburi = EasyRdf\RdfNamespace::shorten($subi) ? EasyRdf\RdfNamespace::shorten($subi) : $subi;
573 573
                         $duplicates[$suburi] = $prop;
@@ -729,14 +729,14 @@  discard block
 block discarded – undo
729 729
 
730 730
             // making a human readable string from the timestamps
731 731
             if ($created != '') {
732
-                $ret = gettext('skosmos:created') . ' ' . (Punic\Calendar::formatDate($created, 'short', $this->getEnvLang()));
732
+                $ret = gettext('skosmos:created').' '.(Punic\Calendar::formatDate($created, 'short', $this->getEnvLang()));
733 733
             }
734 734
 
735 735
             if ($modified != '') {
736 736
                 if ($created != '') {
737
-                    $ret .= ', ' . gettext('skosmos:modified') . ' ' . (Punic\Calendar::formatDate($modified, 'short', $this->getEnvLang()));
737
+                    $ret .= ', '.gettext('skosmos:modified').' '.(Punic\Calendar::formatDate($modified, 'short', $this->getEnvLang()));
738 738
                 } else {
739
-                    $ret .= ' ' . ucfirst(gettext('skosmos:modified')) . ' ' . (Punic\Calendar::formatDate($modified, 'short', $this->getEnvLang()));
739
+                    $ret .= ' '.ucfirst(gettext('skosmos:modified')).' '.(Punic\Calendar::formatDate($modified, 'short', $this->getEnvLang()));
740 740
                 }
741 741
 
742 742
             }
@@ -744,12 +744,12 @@  discard block
 block discarded – undo
744 744
             trigger_error($e->getMessage(), E_USER_WARNING);
745 745
             $ret = '';
746 746
             if ($this->resource->get('dc:modified')) {
747
-                $modified = (string) $this->resource->get('dc:modified');
748
-                $ret = gettext('skosmos:modified') . ' ' . $modified;
747
+                $modified = (string)$this->resource->get('dc:modified');
748
+                $ret = gettext('skosmos:modified').' '.$modified;
749 749
             }
750 750
             if ($this->resource->get('dc:created')) {
751
-                $created .= (string) $this->resource->get('dc:created');
752
-                $ret .= ' ' . gettext('skosmos:created') . ' ' . $created;
751
+                $created .= (string)$this->resource->get('dc:created');
752
+                $ret .= ' '.gettext('skosmos:created').' '.$created;
753 753
             }
754 754
         }
755 755
         return $ret;
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
                     $groups[$collLabel] = array($group);
822 822
 
823 823
                     $res = $collection;
824
-                    while($super = $this->graph->resourcesMatching('skos:member', $res)) {
824
+                    while ($super = $this->graph->resourcesMatching('skos:member', $res)) {
825 825
                         foreach ($super as $res) {
826 826
                             $superprop = new ConceptPropertyValue($this->model, $this->vocab, $res, 'skosmos:memberOfSuper', $this->clang);
827 827
                             array_unshift($groups[$collLabel], $superprop);
@@ -866,7 +866,7 @@  discard block
 block discarded – undo
866 866
 
867 867
         foreach ($labels as $lit) {
868 868
             // filtering away subsets of the current language eg. en vs en-GB
869
-            if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang() . '-') !== 0) {
869
+            if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang().'-') !== 0) {
870 870
                 $langCode = $lit->getLang() ? $lit->getLang() : '';
871 871
                 $ret[$langCode][$key][] = new ConceptPropertyValueLiteral($this->model, $this->vocab, $this->resource, $lit, $prop);
872 872
             }
@@ -958,10 +958,10 @@  discard block
 block discarded – undo
958 958
             }
959 959
             else if ($context[$vocabPrefix] !== $vocabUriSpace) {
960 960
                 $i = 2;
961
-                while (isset($context[$vocabPrefix . $i]) && $context[$vocabPrefix . $i] !== $vocabUriSpace) {
961
+                while (isset($context[$vocabPrefix.$i]) && $context[$vocabPrefix.$i] !== $vocabUriSpace) {
962 962
                     $i += 1;
963 963
                 }
964
-                $context[$vocabPrefix . $i] = $vocabUriSpace;
964
+                $context[$vocabPrefix.$i] = $vocabUriSpace;
965 965
             }
966 966
         }
967 967
         $compactJsonLD = \ML\JsonLD\JsonLD::compact($this->graph->serialise('jsonld'), json_encode($context));
Please login to merge, or discard this patch.
model/ConceptPropertyValue.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
                 }
54 54
                 // We need to check all the labels in case one of them matches a subtag of the current language
55 55
                 if ($this->resource->allLiterals('skos:prefLabel')) {
56
-                    foreach($this->resource->allLiterals('skos:prefLabel') as $label) {
56
+                    foreach ($this->resource->allLiterals('skos:prefLabel') as $label) {
57 57
                         // the label lang code is a subtag of the UI lang eg. en-GB - create a new literal with the main language
58
-                        if ($label !== null && strpos($label->getLang(), $fallback . '-') === 0) {
58
+                        if ($label !== null && strpos($label->getLang(), $fallback.'-') === 0) {
59 59
                             return EasyRdf\Literal::create($label, $fallback);
60 60
                         }
61 61
                     }
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     public function getReifiedPropertyValues() {
157 157
         $ret = array();
158 158
         $props = $this->resource->propertyUris();
159
-        foreach($props as $prop) {
159
+        foreach ($props as $prop) {
160 160
             $prop = (EasyRdf\RdfNamespace::shorten($prop) !== null) ? EasyRdf\RdfNamespace::shorten($prop) : $prop;
161 161
             foreach ($this->resource->allLiterals($prop) as $val) {
162 162
                 if ($prop !== 'rdf:value') { // shown elsewhere
Please login to merge, or discard this patch.