Completed
Pull Request — master (#859)
by
unknown
01:53
created
controller/WebController.php 2 patches
Doc Comments   +8 added lines, -1 removed lines patch added patch discarded remove patch
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
      *
263 263
      * @param Concept $concept
264 264
      * @param Vocabulary $vocab
265
-     * @return DateTime|null
265
+     * @return DateTime
266 266
      */
267 267
     protected function getModifiedDate(Concept $concept, Vocabulary $vocab)
268 268
     {
@@ -438,6 +438,11 @@  discard block
 block discarded – undo
438 438
             ));
439 439
     }
440 440
 
441
+    /**
442
+     * @param string $fromName
443
+     * @param string|null $fromEmail
444
+     * @param string $sender
445
+     */
441 446
     private function createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender)
442 447
     {
443 448
         $headers = "MIME-Version: 1.0″ . '\r\n";
@@ -460,6 +465,7 @@  discard block
 block discarded – undo
460 465
      * @param string $fromName senders own name.
461 466
      * @param string $fromEmail senders email adress.
462 467
      * @param string $fromVocab which vocabulary is the feedback related to.
468
+     * @param string $toMail
463 469
      */
464 470
     public function sendFeedback($request, $message, $fromName = null, $fromEmail = null, $fromVocab = null, $toMail = null)
465 471
     {
@@ -740,6 +746,7 @@  discard block
 block discarded – undo
740 746
 
741 747
     /**
742 748
      * Invokes a very generic errorpage.
749
+     * @param string $message
743 750
      */
744 751
     public function invokeGenericErrorPage($request, $message = null)
745 752
     {
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         // specify where to look for templates and cache
43 43
         $loader = new Twig_Loader_Filesystem('view');
44 44
         // initialize Twig environment
45
-        $this->twig = new Twig_Environment($loader, array('cache' => $tmpDir,'auto_reload' => true));
45
+        $this->twig = new Twig_Environment($loader, array('cache' => $tmpDir, 'auto_reload' => true));
46 46
         $this->twig->addExtension(new Twig_Extensions_Extension_I18n());
47 47
         // used for setting the base href for the relative urls
48 48
         $this->twig->addGlobal("BaseHref", $this->getBaseHref());
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
         $this->twig->addFilter(new Twig_SimpleFilter('link_url', array($this, 'linkUrlFilter')));
66 66
 
67 67
         // register a Twig filter for generating strings from language codes with CLDR
68
-        $langFilter = new Twig_SimpleFilter('lang_name', function ($langcode, $lang) {
68
+        $langFilter = new Twig_SimpleFilter('lang_name', function($langcode, $lang) {
69 69
             return Language::getName($langcode, $lang);
70 70
         });
71 71
         $this->twig->addFilter($langFilter);
@@ -112,18 +112,18 @@  discard block
 block discarded – undo
112 112
         $localname = $vocab->getLocalName($uri);
113 113
         if ($localname !== $uri && $localname === urlencode($localname)) {
114 114
             // check that the prefix stripping worked, and there are no problematic chars in localname
115
-            $paramstr = sizeof($params) > 0 ? '?' . http_build_query($params) : '';
115
+            $paramstr = sizeof($params) > 0 ? '?'.http_build_query($params) : '';
116 116
             if ($type && $type !== '' && $type !== 'vocab' && !($localname === '' && $type === 'page')) {
117
-                return "$vocid/$lang/$type/$localname" . $paramstr;
117
+                return "$vocid/$lang/$type/$localname".$paramstr;
118 118
             }
119 119
 
120
-            return "$vocid/$lang/$localname" . $paramstr;
120
+            return "$vocid/$lang/$localname".$paramstr;
121 121
         }
122 122
 
123 123
         // case 2: URI outside vocabulary namespace, or has problematic chars
124 124
         // pass the full URI as parameter instead
125 125
         $params['uri'] = $uri;
126
-        return "$vocid/$lang/$type/?" . http_build_query($params);
126
+        return "$vocid/$lang/$type/?".http_build_query($params);
127 127
     }
128 128
 
129 129
     /**
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
         $dateTime = null;
365 365
         $cache = $this->model->getConfig()->getCache();
366 366
         $cacheKey = "config:modified_date";
367
-        $filename = realpath(__DIR__ . "/../config.ttl");
367
+        $filename = realpath(__DIR__."/../config.ttl");
368 368
         if ($cache->isAvailable()) {
369 369
             $dateTime = $cache->fetch($cacheKey);
370 370
             if (!$dateTime) {
@@ -441,9 +441,9 @@  discard block
 block discarded – undo
441 441
     private function createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender)
442 442
     {
443 443
         $headers = "MIME-Version: 1.0″ . '\r\n";
444
-        $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";
444
+        $headers .= "Content-type: text/html; charset=UTF-8"."\r\n";
445 445
         if (!empty($toMail)) {
446
-            $headers .= "Cc: " . $this->model->getConfig()->getFeedbackAddress() . "\r\n";
446
+            $headers .= "Cc: ".$this->model->getConfig()->getFeedbackAddress()."\r\n";
447 447
         }
448 448
         if (!empty($fromEmail)) {
449 449
             $headers .= "Reply-To: $fromName <$fromEmail>\r\n";
@@ -465,11 +465,11 @@  discard block
 block discarded – undo
465 465
     {
466 466
         $toAddress = ($toMail) ? $toMail : $this->model->getConfig()->getFeedbackAddress();
467 467
         if ($fromVocab !== null && $fromVocab !== '') {
468
-            $message = 'Feedback from vocab: ' . strtoupper($fromVocab) . "<br />" . $message;
468
+            $message = 'Feedback from vocab: '.strtoupper($fromVocab)."<br />".$message;
469 469
         }
470 470
 
471 471
         $envelopeSender = $this->model->getConfig()->getFeedbackEnvelopeSender();
472
-        $subject = $this->model->getConfig()->getServiceName() . " feedback";
472
+        $subject = $this->model->getConfig()->getServiceName()." feedback";
473 473
         // determine the sender address of the message
474 474
         $sender = $this->model->getConfig()->getFeedbackSender();
475 475
         if (empty($sender)) $sender = $envelopeSender;
@@ -482,10 +482,10 @@  discard block
 block discarded – undo
482 482
         $params = empty($envelopeSender) ? '' : "-f $envelopeSender";
483 483
 
484 484
         // adding some information about the user for debugging purposes.
485
-        $message = $message . "<br /><br /> Debugging information:"
486
-            . "<br />Timestamp: " . date(DATE_RFC2822)
487
-            . "<br />User agent: " . $request->getServerConstant('HTTP_USER_AGENT')
488
-            . "<br />Referer: " . $request->getServerConstant('HTTP_REFERER');
485
+        $message = $message."<br /><br /> Debugging information:"
486
+            . "<br />Timestamp: ".date(DATE_RFC2822)
487
+            . "<br />User agent: ".$request->getServerConstant('HTTP_USER_AGENT')
488
+            . "<br />Referer: ".$request->getServerConstant('HTTP_REFERER');
489 489
 
490 490
         try {
491 491
             mail($toAddress, $subject, $message, $headers, $params);
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
             header("HTTP/1.0 404 Not Found");
494 494
             $template = $this->twig->loadTemplate('error-page.twig');
495 495
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
496
-                error_log('Caught exception: ' . $e->getMessage());
496
+                error_log('Caught exception: '.$e->getMessage());
497 497
             }
498 498
 
499 499
             echo $template->render(
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
         $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : null;
541 541
         $vocabObjects = array();
542 542
         if ($vocids) {
543
-            foreach($vocids as $vocid) {
543
+            foreach ($vocids as $vocid) {
544 544
                 $vocabObjects[] = $this->model->getVocabulary($vocid);
545 545
             }
546 546
         }
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
         } catch (Exception $e) {
552 552
             header("HTTP/1.0 404 Not Found");
553 553
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
554
-                error_log('Caught exception: ' . $e->getMessage());
554
+                error_log('Caught exception: '.$e->getMessage());
555 555
             }
556 556
             $this->invokeGenericErrorPage($request, $e->getMessage());
557 557
             return;
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
                 'search_count' => $counts,
568 568
                 'languages' => $this->languages,
569 569
                 'search_results' => $searchResults,
570
-                'rest' => $parameters->getOffset()>0,
570
+                'rest' => $parameters->getOffset() > 0,
571 571
                 'global_search' => true,
572 572
                 'term' => $request->getQueryParamRaw('q'),
573 573
                 'lang_list' => $langList,
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
         } catch (Exception $e) {
593 593
             header("HTTP/1.0 404 Not Found");
594 594
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
595
-                error_log('Caught exception: ' . $e->getMessage());
595
+                error_log('Caught exception: '.$e->getMessage());
596 596
             }
597 597
 
598 598
             echo $template->render(
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
         } catch (Exception $e) {
614 614
             header("HTTP/1.0 404 Not Found");
615 615
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
616
-                error_log('Caught exception: ' . $e->getMessage());
616
+                error_log('Caught exception: '.$e->getMessage());
617 617
             }
618 618
 
619 619
             echo $template->render(
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
                 'vocab' => $vocab,
631 631
                 'search_results' => $searchResults,
632 632
                 'search_count' => $counts,
633
-                'rest' => $parameters->getOffset()>0,
633
+                'rest' => $parameters->getOffset() > 0,
634 634
                 'limit_parent' => $parameters->getParentLimit(),
635 635
                 'limit_type' =>  $request->getQueryParam('type') ? explode('+', $request->getQueryParam('type')) : null,
636 636
                 'limit_group' => $parameters->getGroupLimit(),
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
      * Loads and renders the view containing a list of recent changes in the vocabulary.
760 760
      * @param Request $request
761 761
      */
762
-    public function invokeChangeList($request, $prop='dc:created')
762
+    public function invokeChangeList($request, $prop = 'dc:created')
763 763
     {
764 764
         // set language parameters for gettext
765 765
         $this->setLanguageProperties($request->getLang());
Please login to merge, or discard this patch.