Completed
Pull Request — master (#886)
by
unknown
01:52
created
model/Model.php 2 patches
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -350,10 +350,12 @@  discard block
 block discarded – undo
350 350
                 // register vocabulary ids as RDF namespace prefixes
351 351
                 $prefix = preg_replace('/\W+/', '', $voc->getId()); // strip non-word characters
352 352
                 try {
353
-                    if ($prefix != '' && EasyRdf\RdfNamespace::get($prefix) === null) // if not already defined
353
+                    if ($prefix != '' && EasyRdf\RdfNamespace::get($prefix) === null) {
354
+                      // if not already defined
354 355
                     {
355 356
                         EasyRdf\RdfNamespace::set($prefix, $voc->getUriSpace());
356 357
                     }
358
+                    }
357 359
 
358 360
                 } catch (Exception $e) {
359 361
                     // not valid as namespace identifier, ignore
@@ -475,8 +477,9 @@  discard block
 block discarded – undo
475 477
 
476 478
         // no preferred vocabulary, or it was not found, search in which vocabulary the concept has a label
477 479
         foreach ($vocabs as $vocab) {
478
-            if ($vocab->getConceptLabel($uri, null) !== null)
479
-                return $vocab;
480
+            if ($vocab->getConceptLabel($uri, null) !== null) {
481
+                            return $vocab;
482
+            }
480 483
         }
481 484
 
482 485
         // if the URI couldn't be found, fall back to the first vocabulary
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -218,18 +218,18 @@  discard block
 block discarded – undo
218 218
         }
219 219
 
220 220
         $vocabs = $params->getVocabs();
221
-        $showDeprecated=false;
221
+        $showDeprecated = false;
222 222
         if (sizeof($vocabs) === 1) { // search within vocabulary
223 223
             $voc = $vocabs[0];
224 224
             $sparql = $voc->getSparql();
225
-            $showDeprecated=$voc->getConfig()->getShowDeprecated();
225
+            $showDeprecated = $voc->getConfig()->getShowDeprecated();
226 226
         } else { // multi-vocabulary or global search
227 227
             $voc = null;
228 228
             $sparql = $this->getDefaultSparql();
229 229
             // @TODO : in a global search showDeprecated will always be false and cannot be set globally
230 230
         }
231 231
 
232
-        $results = $sparql->queryConcepts($vocabs, $params->getAdditionalFields(), $params->getUnique(), $params,$showDeprecated);
232
+        $results = $sparql->queryConcepts($vocabs, $params->getAdditionalFields(), $params->getUnique(), $params, $showDeprecated);
233 233
         if ($params->getRest() && $results && $params->getSearchLimit() !== 0) {
234 234
           $results = array_slice($results, $params->getOffset(), $params->getSearchLimit());
235 235
         }
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
     public function getVocabularyCategories()
385 385
     {
386 386
         $cats = $this->globalConfig->getGraph()->allOfType('skos:Concept');
387
-        if(empty($cats)) {
387
+        if (empty($cats)) {
388 388
             return array(new VocabularyCategory($this, null));
389 389
         }
390 390
 
@@ -467,9 +467,9 @@  discard block
 block discarded – undo
467 467
         }
468 468
 
469 469
         // if there are multiple vocabularies and one is the preferred vocabulary, return it
470
-        if($preferredVocabId != null) {
470
+        if ($preferredVocabId != null) {
471 471
             foreach ($vocabs as $vocab) {
472
-                if($vocab->getId() == $preferredVocabId) {
472
+                if ($vocab->getId() == $preferredVocabId) {
473 473
                     // double check that a label exists in the preferred vocabulary
474 474
                     if ($vocab->getConceptLabel($uri, null) !== null) {
475 475
                         return $vocab;
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
         // using apc cache for the resource if available
576 576
         if ($this->globalConfig->getCache()->isAvailable()) {
577 577
             // @codeCoverageIgnoreStart
578
-            $key = 'fetch: ' . $uri;
578
+            $key = 'fetch: '.$uri;
579 579
             $resource = $this->globalConfig->getCache()->fetch($key);
580 580
             if ($resource === null || $resource === false) { // was not found in cache, or previous request failed
581 581
                 $resource = $this->fetchResourceFromUri($uri);
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
      */
597 597
     public function getSparqlImplementation($dialect, $endpoint, $graph)
598 598
     {
599
-        $classname = $dialect . "Sparql";
599
+        $classname = $dialect."Sparql";
600 600
 
601 601
         return new $classname($endpoint, $graph, $this);
602 602
     }
Please login to merge, or discard this patch.
model/BaseConfig.php 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
      * @param string $default default value
43 43
      * @param string $lang preferred language for the literal
44 44
      */
45
-    protected function getLiteral($property, $default=null, $lang=null)
45
+    protected function getLiteral($property, $default = null, $lang = null)
46 46
     {
47 47
         if (!isset($lang)) {;
48 48
             $lang = $this->getEnvLang();
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,8 +55,9 @@
 block discarded – undo
55 55
 
56 56
         // not found with selected language, try any language
57 57
         $literal = $this->getResource()->getLiteral($property);
58
-        if ($literal)
59
-          return $literal->getValue();
58
+        if ($literal) {
59
+                  return $literal->getValue();
60
+        }
60 61
 
61 62
         return $default;
62 63
     }
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,11 +7,11 @@
 block discarded – undo
7 7
 abstract class BaseConfig extends DataObject
8 8
 {
9 9
 
10
-	/**
11
-     * Returns a boolean value based on a literal value from the config.ttl configuration.
12
-     * @param string $property the property to query
13
-     * @param boolean $default the default value if the value is not set in configuration
14
-     */
10
+  /**
11
+   * Returns a boolean value based on a literal value from the config.ttl configuration.
12
+   * @param string $property the property to query
13
+   * @param boolean $default the default value if the value is not set in configuration
14
+   */
15 15
     protected function getBoolean($property, $default = false)
16 16
     {
17 17
         $val = $this->getResource()->getLiteral($property);
Please login to merge, or discard this patch.
model/VocabularyConfig.php 3 patches
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -58,8 +58,9 @@  discard block
 block discarded – undo
58 58
     public function getShortName()
59 59
     {
60 60
         $shortname = $this->getLiteral('skosmos:shortName');
61
-        if ($shortname)
62
-          return $shortname;
61
+        if ($shortname) {
62
+                  return $shortname;
63
+        }
63 64
 
64 65
         // if no shortname exists fall back to the id
65 66
         return $this->getId();
@@ -194,10 +195,12 @@  discard block
 block discarded – undo
194 195
         $ret = array();
195 196
         foreach ($resources as $res) {
196 197
             $prop = $res->getURI();
197
-            if (EasyRdf\RdfNamespace::shorten($prop) !== null) // shortening property labels if possible
198
+            if (EasyRdf\RdfNamespace::shorten($prop) !== null) {
199
+              // shortening property labels if possible
198 200
             {
199 201
                 $prop = EasyRdf\RdfNamespace::shorten($prop);
200 202
             }
203
+            }
201 204
 
202 205
             $ret[] = $prop;
203 206
         }
@@ -214,10 +217,12 @@  discard block
 block discarded – undo
214 217
         $resources = $this->resource->allResources("skosmos:hasMultiLingualProperty");
215 218
         foreach ($resources as $res) {
216 219
             $prop = $res->getURI();
217
-            if (EasyRdf\RdfNamespace::shorten($prop) !== null) // shortening property labels if possible
220
+            if (EasyRdf\RdfNamespace::shorten($prop) !== null) {
221
+              // shortening property labels if possible
218 222
             {
219 223
                 $prop = EasyRdf\RdfNamespace::shorten($prop);
220 224
             }
225
+            }
221 226
 
222 227
             if ($prop === $property) {
223 228
                 return true;
@@ -329,11 +334,12 @@  discard block
 block discarded – undo
329 334
     public function getId()
330 335
     {
331 336
         $uriparts = explode("#", $this->resource->getURI());
332
-        if (count($uriparts) != 1)
333
-        // hash namespace
337
+        if (count($uriparts) != 1) {
338
+                // hash namespace
334 339
         {
335 340
             return $uriparts[1];
336 341
         }
342
+        }
337 343
 
338 344
         // slash namespace
339 345
         $uriparts = explode("/", $this->resource->getURI());
@@ -361,10 +367,12 @@  discard block
 block discarded – undo
361 367
         $ret = array();
362 368
         foreach ($resources as $res) {
363 369
             $prop = $res->getURI();
364
-            if (EasyRdf\RdfNamespace::shorten($prop) !== null) // prefixing if possible
370
+            if (EasyRdf\RdfNamespace::shorten($prop) !== null) {
371
+              // prefixing if possible
365 372
             {
366 373
                 $prop = EasyRdf\RdfNamespace::shorten($prop);
367 374
             }
375
+            }
368 376
 
369 377
             $ret[] = $prop;
370 378
         }
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -266,6 +266,7 @@  discard block
 block discarded – undo
266 266
 
267 267
     /**
268 268
      * Returns skosmos:marcSourcecode value set in config.ttl.
269
+     * @param string $lang
269 270
      * @return string marcsource name
270 271
      */
271 272
     public function getMarcSourceCode($lang = null)
@@ -275,7 +276,7 @@  discard block
 block discarded – undo
275 276
 
276 277
     /**
277 278
      * Returns a boolean value set in the config.ttl config.
278
-     * @return array array of concept class URIs (can be empty)
279
+     * @return string[] array of concept class URIs (can be empty)
279 280
      */
280 281
     public function getIndexClasses()
281 282
     {
@@ -284,7 +285,7 @@  discard block
 block discarded – undo
284 285
 
285 286
     /**
286 287
      * Returns skosmos:externalProperty values set in the config.ttl config.
287
-     * @return array array of external property URIs (can be empty)
288
+     * @return string[] array of external property URIs (can be empty)
288 289
      */
289 290
     public function getExtProperties()
290 291
     {
@@ -410,6 +411,7 @@  discard block
 block discarded – undo
410 411
 
411 412
     /**
412 413
      * Returns the vocabulary dc:type value(s) with their labels and uris, if set in the vocabulary configuration.
414
+     * @param string $lang
413 415
      * @return array of objects or an empty array
414 416
      */
415 417
     public function getTypes($lang = null)
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
     private $plugins;
9 9
     private $languageOrderCache = array();
10 10
 
11
-    public function __construct($resource, $globalPlugins=array())
11
+    public function __construct($resource, $globalPlugins = array())
12 12
     {
13 13
         $this->resource = $resource;
14 14
         $plugins = $this->resource->allLiterals('skosmos:usePlugin');
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
         $langs = $this->getLanguages();
37 37
         $deflang = reset($langs); // picking the first one from the list with reset since the keys are not numeric
38 38
         if (sizeof($langs) > 1) {
39
-            trigger_error("Default language for vocabulary '" . $this->getShortName() . "' unknown, choosing '$deflang'.", E_USER_WARNING);
39
+            trigger_error("Default language for vocabulary '".$this->getShortName()."' unknown, choosing '$deflang'.", E_USER_WARNING);
40 40
         }
41 41
 
42 42
         return $deflang;
Please login to merge, or discard this patch.
migrate-config.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@
 block discarded – undo
84 84
     foreach (explode(' ', GLOBAL_PLUGINS) as $pluginName) {
85 85
         $globalPluginsArray[] = "\"$pluginName\"";
86 86
     }
87
-    $globalPlugins = " " . implode(', ', $globalPluginsArray) . " ";
87
+    $globalPlugins = " ".implode(', ', $globalPluginsArray)." ";
88 88
 }
89 89
 
90 90
 # print the prefixes
Please login to merge, or discard this patch.
model/ConceptProperty.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      * @param string $prop property type eg. 'rdf:type'.
23 23
      * @param string $label
24 24
      */
25
-    public function __construct($prop, $label, $super=null, $sort_by_notation=false)
25
+    public function __construct($prop, $label, $super = null, $sort_by_notation = false)
26 26
     {
27 27
         $this->prop = $prop;
28 28
         $this->label = $label;
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      */
62 62
     public function getDescription()
63 63
     {
64
-        $helpprop = $this->prop . "_help";
64
+        $helpprop = $this->prop."_help";
65 65
 
66 66
         return gettext($helpprop); // can't use string constant, it'd be picked up by xgettext
67 67
     }
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
     public function addValue($value)
82 82
     {
83
-        $this->values[$value->getNotation() . $value->getLabel() . $value->getUri()] = $value;
83
+        $this->values[$value->getNotation().$value->getLabel().$value->getUri()] = $value;
84 84
         $this->is_sorted = false;
85 85
     }
86 86
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     {
89 89
         if (!empty($this->values)) {
90 90
             uksort($this->values, function($a, $b) {
91
-                return $this->sort_by_notation ? strnatcasecmp($a, $b) : strcoll(strtolower($a),strtolower($b));
91
+                return $this->sort_by_notation ? strnatcasecmp($a, $b) : strcoll(strtolower($a), strtolower($b));
92 92
             });
93 93
         }
94 94
         $this->is_sorted = true;
Please login to merge, or discard this patch.
controller/Controller.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@
 block discarded – undo
137 137
     {
138 138
         if ($modifiedDate) {
139 139
             $ifModifiedSince = $this->getIfModifiedSince();
140
-            $this->sendHeader("Last-Modified: " . $modifiedDate->format('Y-m-d H:i:s'));
140
+            $this->sendHeader("Last-Modified: ".$modifiedDate->format('Y-m-d H:i:s'));
141 141
             if (!is_null($ifModifiedSince) && $ifModifiedSince >= $modifiedDate) {
142 142
                 $this->sendHeader("HTTP/1.0 304 Not Modified");
143 143
                 return true;
Please login to merge, or discard this patch.
controller/EntityController.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,14 +30,14 @@
 block discarded – undo
30 30
             $url = $baseurl . "$vocid/";
31 31
         } else {
32 32
 
33
-   	        if ($localname !== $uri && $localname === urlencode($localname)) {
34
-   	        // the URI can be shortened
33
+              if ($localname !== $uri && $localname === urlencode($localname)) {
34
+              // the URI can be shortened
35 35
             $url = $baseurl . "$vocid/page/$localname";
36 36
             } else {
37 37
                 // must use full URI
38
-   	            $query = http_build_query(array('uri'=>$uri));
38
+                  $query = http_build_query(array('uri'=>$uri));
39 39
                 $url = $baseurl . "$vocid/page/?" . $query;
40
-	        }
40
+          }
41 41
         }
42 42
         $this->redirect303($url);
43 43
     }
Please login to merge, or discard this 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);
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
             // guess vocabulary based on URI
58 58
             $vocab = $this->model->guessVocabularyFromURI($request->getUri());
59 59
             if ($vocab === null) {
60
-                return $this->returnError('404', 'Not Found', 'Unrecognized URI ' . $request->getUri());
60
+                return $this->returnError('404', 'Not Found', 'Unrecognized URI '.$request->getUri());
61 61
             }
62 62
             $request->setVocab($vocab->getId());
63 63
         }
Please login to merge, or discard this patch.
model/ConceptMappingPropertyValue.php 1 patch
Spacing   +6 added lines, -6 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 $notation . $label;
39
+        return $notation.$label;
40 40
     }
41 41
 
42 42
     public function getType()
@@ -178,14 +178,14 @@  discard block
 block discarded – undo
178 178
             'from' => [
179 179
                 'memberSet' => [
180 180
                     [
181
-                        'uri' => (string) $this->source->getUri(),
181
+                        'uri' => (string)$this->source->getUri(),
182 182
                     ]
183 183
                 ]
184 184
             ],
185 185
             'to' => [
186 186
                 'memberSet' => [
187 187
                     [
188
-                        'uri' => (string) $this->getUri()
188
+                        'uri' => (string)$this->getUri()
189 189
                     ]
190 190
                 ]
191 191
             ]
@@ -194,20 +194,20 @@  discard block
 block discarded – undo
194 194
         $fromScheme = $this->vocab->getDefaultConceptScheme();
195 195
         if (isset($fromScheme)) {
196 196
             $ret['fromScheme'] = [
197
-                'uri' => (string) $fromScheme,
197
+                'uri' => (string)$fromScheme,
198 198
             ];
199 199
         }
200 200
 
201 201
         $exvocab = $this->getExvocab();
202 202
         if (isset($exvocab)) {
203 203
             $ret['toScheme'] = [
204
-                'uri' => (string) $exvocab->getDefaultConceptScheme(),
204
+                'uri' => (string)$exvocab->getDefaultConceptScheme(),
205 205
             ];
206 206
         }
207 207
 
208 208
         $notation = $this->getNotation();
209 209
         if (isset($notation)) {
210
-            $ret['to']['memberSet'][0]['notation'] = (string) $notation;
210
+            $ret['to']['memberSet'][0]['notation'] = (string)$notation;
211 211
         }
212 212
 
213 213
         $label = $this->getLabel(null, $queryExVocabs);
Please login to merge, or discard this patch.
controller/WebController.php 3 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   +22 added lines, -22 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());
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         $this->twig->addFilter($labelSorter);
70 70
 
71 71
         // register a Twig filter for generating strings from language codes with CLDR
72
-        $langFilter = new Twig_SimpleFilter('lang_name', function ($langcode, $lang) {
72
+        $langFilter = new Twig_SimpleFilter('lang_name', function($langcode, $lang) {
73 73
             return Language::getName($langcode, $lang);
74 74
         });
75 75
         $this->twig->addFilter($langFilter);
@@ -116,18 +116,18 @@  discard block
 block discarded – undo
116 116
         $localname = $vocab->getLocalName($uri);
117 117
         if ($localname !== $uri && $localname === urlencode($localname)) {
118 118
             // check that the prefix stripping worked, and there are no problematic chars in localname
119
-            $paramstr = sizeof($params) > 0 ? '?' . http_build_query($params) : '';
119
+            $paramstr = sizeof($params) > 0 ? '?'.http_build_query($params) : '';
120 120
             if ($type && $type !== '' && $type !== 'vocab' && !($localname === '' && $type === 'page')) {
121
-                return "$vocid/$lang/$type/$localname" . $paramstr;
121
+                return "$vocid/$lang/$type/$localname".$paramstr;
122 122
             }
123 123
 
124
-            return "$vocid/$lang/$localname" . $paramstr;
124
+            return "$vocid/$lang/$localname".$paramstr;
125 125
         }
126 126
 
127 127
         // case 2: URI outside vocabulary namespace, or has problematic chars
128 128
         // pass the full URI as parameter instead
129 129
         $params['uri'] = $uri;
130
-        return "$vocid/$lang/$type/?" . http_build_query($params);
130
+        return "$vocid/$lang/$type/?".http_build_query($params);
131 131
     }
132 132
 
133 133
     /**
@@ -434,9 +434,9 @@  discard block
 block discarded – undo
434 434
     private function createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender)
435 435
     {
436 436
         $headers = "MIME-Version: 1.0″ . '\r\n";
437
-        $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";
437
+        $headers .= "Content-type: text/html; charset=UTF-8"."\r\n";
438 438
         if (!empty($toMail)) {
439
-            $headers .= "Cc: " . $this->model->getConfig()->getFeedbackAddress() . "\r\n";
439
+            $headers .= "Cc: ".$this->model->getConfig()->getFeedbackAddress()."\r\n";
440 440
         }
441 441
         if (!empty($fromEmail)) {
442 442
             $headers .= "Reply-To: $fromName <$fromEmail>\r\n";
@@ -458,11 +458,11 @@  discard block
 block discarded – undo
458 458
     {
459 459
         $toAddress = ($toMail) ? $toMail : $this->model->getConfig()->getFeedbackAddress();
460 460
         if ($fromVocab !== null && $fromVocab !== '') {
461
-            $message = 'Feedback from vocab: ' . strtoupper($fromVocab) . "<br />" . $message;
461
+            $message = 'Feedback from vocab: '.strtoupper($fromVocab)."<br />".$message;
462 462
         }
463 463
 
464 464
         $envelopeSender = $this->model->getConfig()->getFeedbackEnvelopeSender();
465
-        $subject = $this->model->getConfig()->getServiceName() . " feedback";
465
+        $subject = $this->model->getConfig()->getServiceName()." feedback";
466 466
         // determine the sender address of the message
467 467
         $sender = $this->model->getConfig()->getFeedbackSender();
468 468
         if (empty($sender)) $sender = $envelopeSender;
@@ -475,10 +475,10 @@  discard block
 block discarded – undo
475 475
         $params = empty($envelopeSender) ? '' : "-f $envelopeSender";
476 476
 
477 477
         // adding some information about the user for debugging purposes.
478
-        $message = $message . "<br /><br /> Debugging information:"
479
-            . "<br />Timestamp: " . date(DATE_RFC2822)
480
-            . "<br />User agent: " . $request->getServerConstant('HTTP_USER_AGENT')
481
-            . "<br />Referer: " . $request->getServerConstant('HTTP_REFERER');
478
+        $message = $message."<br /><br /> Debugging information:"
479
+            . "<br />Timestamp: ".date(DATE_RFC2822)
480
+            . "<br />User agent: ".$request->getServerConstant('HTTP_USER_AGENT')
481
+            . "<br />Referer: ".$request->getServerConstant('HTTP_REFERER');
482 482
 
483 483
         try {
484 484
             mail($toAddress, $subject, $message, $headers, $params);
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
             header("HTTP/1.0 404 Not Found");
487 487
             $template = $this->twig->loadTemplate('error-page.twig');
488 488
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
489
-                error_log('Caught exception: ' . $e->getMessage());
489
+                error_log('Caught exception: '.$e->getMessage());
490 490
             }
491 491
 
492 492
             echo $template->render(
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
         $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : null;
534 534
         $vocabObjects = array();
535 535
         if ($vocids) {
536
-            foreach($vocids as $vocid) {
536
+            foreach ($vocids as $vocid) {
537 537
                 $vocabObjects[] = $this->model->getVocabulary($vocid);
538 538
             }
539 539
         }
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
         } catch (Exception $e) {
545 545
             header("HTTP/1.0 404 Not Found");
546 546
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
547
-                error_log('Caught exception: ' . $e->getMessage());
547
+                error_log('Caught exception: '.$e->getMessage());
548 548
             }
549 549
             $this->invokeGenericErrorPage($request, $e->getMessage());
550 550
             return;
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
                 'search_count' => $counts,
561 561
                 'languages' => $this->languages,
562 562
                 'search_results' => $searchResults,
563
-                'rest' => $parameters->getOffset()>0,
563
+                'rest' => $parameters->getOffset() > 0,
564 564
                 'global_search' => true,
565 565
                 'term' => $request->getQueryParamRaw('q'),
566 566
                 'lang_list' => $langList,
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
         } catch (Exception $e) {
586 586
             header("HTTP/1.0 404 Not Found");
587 587
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
588
-                error_log('Caught exception: ' . $e->getMessage());
588
+                error_log('Caught exception: '.$e->getMessage());
589 589
             }
590 590
 
591 591
             echo $template->render(
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
         } catch (Exception $e) {
607 607
             header("HTTP/1.0 404 Not Found");
608 608
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
609
-                error_log('Caught exception: ' . $e->getMessage());
609
+                error_log('Caught exception: '.$e->getMessage());
610 610
             }
611 611
 
612 612
             echo $template->render(
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
                 'vocab' => $vocab,
624 624
                 'search_results' => $searchResults,
625 625
                 'search_count' => $counts,
626
-                'rest' => $parameters->getOffset()>0,
626
+                'rest' => $parameters->getOffset() > 0,
627 627
                 'limit_parent' => $parameters->getParentLimit(),
628 628
                 'limit_type' =>  $request->getQueryParam('type') ? explode('+', $request->getQueryParam('type')) : null,
629 629
                 'limit_group' => $parameters->getGroupLimit(),
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
      * Loads and renders the view containing a list of recent changes in the vocabulary.
753 753
      * @param Request $request
754 754
      */
755
-    public function invokeChangeList($request, $prop='dc:created')
755
+    public function invokeChangeList($request, $prop = 'dc:created')
756 756
     {
757 757
         // set language parameters for gettext
758 758
         $this->setLanguageProperties($request->getLang());
Please login to merge, or discard this patch.
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -137,10 +137,11 @@  discard block
 block discarded – undo
137 137
     public function labelSorter($conceptPropertyValueArray) {
138 138
         usort($conceptPropertyValueArray, function($lit, $lit2) {
139 139
             if ($lit->getType() === $lit2->getType()) {
140
-                if ($lit->getLabel() === $lit2->getLabel()) return 0;
140
+                if ($lit->getLabel() === $lit2->getLabel()) {
141
+                  return 0;
142
+                }
141 143
                 return $lit->getLabel() < $lit2->getLabel() ? -1 : 1;
142
-            }
143
-            else if ($lit->getType() === "skos:prefLabel") {
144
+            } else if ($lit->getType() === "skos:prefLabel") {
144 145
                 return -1;
145 146
             }
146 147
             return 1;
@@ -465,11 +466,17 @@  discard block
 block discarded – undo
465 466
         $subject = $this->model->getConfig()->getServiceName() . " feedback";
466 467
         // determine the sender address of the message
467 468
         $sender = $this->model->getConfig()->getFeedbackSender();
468
-        if (empty($sender)) $sender = $envelopeSender;
469
-        if (empty($sender)) $sender = $this->model->getConfig()->getFeedbackAddress();
469
+        if (empty($sender)) {
470
+          $sender = $envelopeSender;
471
+        }
472
+        if (empty($sender)) {
473
+          $sender = $this->model->getConfig()->getFeedbackAddress();
474
+        }
470 475
 
471 476
         // determine sender name - default to "anonymous user" if not given by user
472
-        if (empty($fromName)) $fromName = "anonymous user";
477
+        if (empty($fromName)) {
478
+          $fromName = "anonymous user";
479
+        }
473 480
 
474 481
         $headers = $this->createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender);
475 482
         $params = empty($envelopeSender) ? '' : "-f $envelopeSender";
Please login to merge, or discard this patch.