Passed
Push — master ( 124785...a379ee )
by Osma
05:22 queued 49s
created
controller/WebController.php 1 patch
Spacing   +23 added lines, -23 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,7 +328,7 @@  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
                 $vocabObjects[] = $this->model->getVocabulary($vocid);
333 333
             }
334 334
         }
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
         } catch (Exception $e) {
340 340
             header("HTTP/1.0 404 Not Found");
341 341
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
342
-                error_log('Caught exception: ' . $e->getMessage());
342
+                error_log('Caught exception: '.$e->getMessage());
343 343
             }
344 344
             $this->invokeGenericErrorPage($request, $e->getMessage());
345 345
             return;
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
                 'search_count' => $counts,
356 356
                 'languages' => $this->languages,
357 357
                 'search_results' => $searchResults,
358
-                'rest' => $parameters->getOffset()>0,
358
+                'rest' => $parameters->getOffset() > 0,
359 359
                 'global_search' => true,
360 360
                 'term' => $request->getQueryParamRaw('q'),
361 361
                 'lang_list' => $langList,
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
         } catch (Exception $e) {
381 381
             header("HTTP/1.0 500 Internal Server Error");
382 382
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
383
-                error_log('Caught exception: ' . $e->getMessage());
383
+                error_log('Caught exception: '.$e->getMessage());
384 384
             }
385 385
 
386 386
             echo $template->render(
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
         } catch (Exception $e) {
404 404
             header("HTTP/1.0 404 Not Found");
405 405
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
406
-                error_log('Caught exception: ' . $e->getMessage());
406
+                error_log('Caught exception: '.$e->getMessage());
407 407
             }
408 408
 
409 409
             echo $template->render(
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
                 'vocab' => $vocab,
421 421
                 'search_results' => $searchResults,
422 422
                 'search_count' => $counts,
423
-                'rest' => $parameters->getOffset()>0,
423
+                'rest' => $parameters->getOffset() > 0,
424 424
                 'limit_parent' => $parameters->getParentLimit(),
425 425
                 'limit_type' =>  $request->getQueryParam('type') ? explode('+', $request->getQueryParam('type')) : null,
426 426
                 'limit_group' => $parameters->getGroupLimit(),
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
      * Loads and renders the view containing a list of recent changes in the vocabulary.
552 552
      * @param Request $request
553 553
      */
554
-    public function invokeChangeList($request, $prop='dc:created')
554
+    public function invokeChangeList($request, $prop = 'dc:created')
555 555
     {
556 556
         $offset = ($request->getQueryParam('offset') && is_numeric($request->getQueryParam('offset')) && $request->getQueryParam('offset') >= 0) ? $request->getQueryParam('offset') : 0;
557 557
         $limit = ($request->getQueryParam('limit') && is_numeric($request->getQueryParam('limit')) && $request->getQueryParam('limit') >= 0) ? $request->getQueryParam('limit') : 200;
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
      * @param int $limit maximum number of concepts to return
580 580
      * @return Array list of concepts
581 581
      */
582
-    public function getChangeList($request, $prop, $offset=0, $limit=200)
582
+    public function getChangeList($request, $prop, $offset = 0, $limit = 200)
583 583
     {
584 584
         // set language parameters for gettext
585 585
         $this->setLanguageProperties($request->getLang());
@@ -596,9 +596,9 @@  discard block
 block discarded – undo
596 596
     public function formatChangeList($changeList, $lang)
597 597
     {
598 598
         $formatByDate = array();
599
-        foreach($changeList as $concept) {
599
+        foreach ($changeList as $concept) {
600 600
             $concept['datestring'] = Punic\Calendar::formatDate($concept['date'], 'medium', $lang);
601
-            $formatByDate[Punic\Calendar::getMonthName($concept['date'], 'wide', $lang, true) . Punic\Calendar::format($concept['date'], ' y', $lang) ][strtolower($concept['prefLabel'])] = $concept;
601
+            $formatByDate[Punic\Calendar::getMonthName($concept['date'], 'wide', $lang, true).Punic\Calendar::format($concept['date'], ' y', $lang)][strtolower($concept['prefLabel'])] = $concept;
602 602
         }
603 603
         return $formatByDate;
604 604
     }
Please login to merge, or discard this patch.
model/Vocabulary.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -163,10 +163,10 @@  discard block
 block discarded – undo
163 163
             $sparql = $this->getSparql();
164 164
             $result = $sparql->queryConceptScheme($defaultcs);
165 165
         } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) {
166
-             if ($this->model->getConfig()->getLogCaughtExceptions()) {
167
-                 error_log('Caught exception: ' . $e->getMessage());
168
-             }
169
-             return null;
166
+              if ($this->model->getConfig()->getLogCaughtExceptions()) {
167
+                  error_log('Caught exception: ' . $e->getMessage());
168
+              }
169
+              return null;
170 170
         }
171 171
         $conceptscheme = $result->resource($defaultcs);
172 172
         $this->order = array(
@@ -253,9 +253,9 @@  discard block
 block discarded – undo
253 253
         try {
254 254
             $conceptSchemes = $this->getSparql()->queryConceptSchemes($lang);
255 255
         } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) {
256
-             if ($this->model->getConfig()->getLogCaughtExceptions()) {
257
-                 error_log('Caught exception: ' . $e->getMessage());
258
-             }
256
+              if ($this->model->getConfig()->getLogCaughtExceptions()) {
257
+                  error_log('Caught exception: ' . $e->getMessage());
258
+              }
259 259
         }
260 260
         return $conceptSchemes;
261 261
     }
@@ -453,9 +453,9 @@  discard block
 block discarded – undo
453 453
         try {
454 454
             $conceptInfo = $sparql->queryConceptInfo($uri, $this->config->getArrayClassURI(), array($this), $clang);
455 455
         } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) {
456
-             if ($this->model->getConfig()->getLogCaughtExceptions()) {
457
-                 error_log('Caught exception: ' . $e->getMessage());
458
-             }
456
+              if ($this->model->getConfig()->getLogCaughtExceptions()) {
457
+                  error_log('Caught exception: ' . $e->getMessage());
458
+              }
459 459
         }
460 460
         return $conceptInfo;
461 461
     }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
             return $lname;
103 103
         }
104 104
         // already a full URI
105
-        return $this->getUriSpace() . $lname;
105
+        return $this->getUriSpace().$lname;
106 106
     }
107 107
 
108 108
     /**
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
             // query everything the endpoint knows about the ConceptScheme
163 163
             $sparql = $this->getSparql();
164 164
             $result = $sparql->queryConceptScheme($defaultcs);
165
-        } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) {
165
+        } catch (EasyRdf\Http\Exception |  EasyRdf\Exception  | Throwable $e) {
166 166
              if ($this->model->getConfig()->getLogCaughtExceptions()) {
167
-                 error_log('Caught exception: ' . $e->getMessage());
167
+                 error_log('Caught exception: '.$e->getMessage());
168 168
              }
169 169
              return null;
170 170
         }
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
                 foreach ($conceptscheme->allLiterals($prop, null) as $val) {
198 198
                     $prop = (substr($prop, 0, 5) == 'dc11:') ? str_replace('dc11:', 'dc:', $prop) : $prop;
199 199
                     if ($val->getValue() instanceof DateTime) {
200
-                        $val = Punic\Calendar::formatDate($val->getValue(), 'full', $lang) . ' ' . Punic\Calendar::format($val->getValue(), 'HH:mm:ss', $lang);
200
+                        $val = Punic\Calendar::formatDate($val->getValue(), 'full', $lang).' '.Punic\Calendar::format($val->getValue(), 'HH:mm:ss', $lang);
201 201
                     }
202 202
                     $ret[$prop][] = $val;
203 203
                 }
@@ -252,9 +252,9 @@  discard block
 block discarded – undo
252 252
         $conceptSchemes = null;
253 253
         try {
254 254
             $conceptSchemes = $this->getSparql()->queryConceptSchemes($lang);
255
-        } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) {
255
+        } catch (EasyRdf\Http\Exception |  EasyRdf\Exception |  Throwable $e) {
256 256
              if ($this->model->getConfig()->getLogCaughtExceptions()) {
257
-                 error_log('Caught exception: ' . $e->getMessage());
257
+                 error_log('Caught exception: '.$e->getMessage());
258 258
              }
259 259
         }
260 260
         return $conceptSchemes;
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
         }
326 326
         // don't know how to parse
327 327
         $rev = $parts[2];
328
-        $datestr = $parts[3] . ' ' . $parts[4];
328
+        $datestr = $parts[3].' '.$parts[4];
329 329
 
330 330
         return "$datestr (r$rev)";
331 331
     }
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
      * @param string $array the uri of the concept array class, eg. isothes:ThesaurusArray
337 337
      * @param string $group the uri of the  concept group class, eg. isothes:ConceptGroup
338 338
      */
339
-    public function getStatistics($lang = '', $array=null, $group=null)
339
+    public function getStatistics($lang = '', $array = null, $group = null)
340 340
     {
341 341
         $sparql = $this->getSparql();
342 342
         // find the number of concepts
@@ -452,9 +452,9 @@  discard block
 block discarded – undo
452 452
         $conceptInfo = null;
453 453
         try {
454 454
             $conceptInfo = $sparql->queryConceptInfo($uri, $this->config->getArrayClassURI(), array($this), $clang);
455
-        } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) {
455
+        } catch (EasyRdf\Http\Exception |  EasyRdf\Exception |  Throwable $e) {
456 456
              if ($this->model->getConfig()->getLogCaughtExceptions()) {
457
-                 error_log('Caught exception: ' . $e->getMessage());
457
+                 error_log('Caught exception: '.$e->getMessage());
458 458
              }
459 459
         }
460 460
         return $conceptInfo;
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
       return $this->getSparql()->queryChangeList($prop, $clang, $offset, $limit);
665 665
     }
666 666
 
667
-    public function getTitle($lang=null) {
667
+    public function getTitle($lang = null) {
668 668
       return $this->config->getTitle($lang);
669 669
     }
670 670
 
Please login to merge, or discard this patch.