Completed
Push — master ( da8118...a9932f )
by Henri
03:08
created
model/Model.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -65,15 +65,15 @@  discard block
 block discarded – undo
65 65
     private function initializeVocabularies()
66 66
     {
67 67
         if (!file_exists($this->getConfig()->getVocabularyConfigFile())) {
68
-            throw new Exception($this->getConfig()->getVocabularyConfigFile() . ' is missing, please provide one.');
68
+            throw new Exception($this->getConfig()->getVocabularyConfigFile().' is missing, please provide one.');
69 69
         }
70 70
 
71 71
         try {
72 72
             // use APC user cache to store parsed vocabularies.ttl configuration
73 73
             if (function_exists('apc_store') && function_exists('apc_fetch')) {
74 74
                 // @codeCoverageIgnoreStart
75
-                $key = realpath($this->getConfig()->getVocabularyConfigFile()) . ", " . filemtime($this->getConfig()->getVocabularyConfigFile());
76
-                $nskey = "namespaces of " . $key;
75
+                $key = realpath($this->getConfig()->getVocabularyConfigFile()).", ".filemtime($this->getConfig()->getVocabularyConfigFile());
76
+                $nskey = "namespaces of ".$key;
77 77
                 $this->graph = apc_fetch($key);
78 78
                 $this->namespaces = apc_fetch($nskey);
79 79
                 if ($this->graph === false || $this->namespaces === false) { // was not found in cache
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
                 $this->parseVocabularies($this->getConfig()->getVocabularyConfigFile());
87 87
             }
88 88
         } catch (Exception $e) {
89
-            echo "Error: " . $e->getMessage();
89
+            echo "Error: ".$e->getMessage();
90 90
         }
91 91
     }
92 92
 
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
     public function getVocabularyCategories()
425 425
     {
426 426
         $cats = $this->graph->allOfType('skos:Concept');
427
-        if(empty($cats)) {
427
+        if (empty($cats)) {
428 428
             return array(new VocabularyCategory($this, null));
429 429
         }
430 430
 
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
         // using apc cache for the resource if available
572 572
         if (function_exists('apc_store') && function_exists('apc_fetch')) {
573 573
             // @codeCoverageIgnoreStart
574
-            $key = 'fetch: ' . EasyRdf_Utils::removeFragmentFromUri($uri);
574
+            $key = 'fetch: '.EasyRdf_Utils::removeFragmentFromUri($uri);
575 575
             $resource = apc_fetch($key);
576 576
             if ($resource === null || $resource === false) { // was not found in cache, or previous request failed
577 577
                 $resource = $this->fetchResourceFromUri($uri);
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
      */
593 593
     public function getSparqlImplementation($dialect, $endpoint, $graph)
594 594
     {
595
-        $classname = $dialect . "Sparql";
595
+        $classname = $dialect."Sparql";
596 596
 
597 597
         return new $classname($endpoint, $graph, $this);
598 598
     }
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -109,10 +109,12 @@  discard block
 block discarded – undo
109 109
     
110 110
     private function initializeNamespaces() {
111 111
         foreach ($this->namespaces as $prefix => $fullUri) {
112
-            if ($prefix != '' && EasyRdf_Namespace::get($prefix) === null) // if not already defined
112
+            if ($prefix != '' && EasyRdf_Namespace::get($prefix) === null) {
113
+              // if not already defined
113 114
             {
114 115
                 EasyRdf_Namespace::set($prefix, $fullUri);
115 116
             }
117
+            }
116 118
         }
117 119
     }
118 120
 
@@ -391,10 +393,12 @@  discard block
 block discarded – undo
391 393
                 // register vocabulary ids as RDF namespace prefixes
392 394
                 $prefix = preg_replace('/\W+/', '', $voc->getId()); // strip non-word characters
393 395
                 try {
394
-                    if ($prefix != '' && EasyRdf_Namespace::get($prefix) === null) // if not already defined
396
+                    if ($prefix != '' && EasyRdf_Namespace::get($prefix) === null) {
397
+                      // if not already defined
395 398
                     {
396 399
                         EasyRdf_Namespace::set($prefix, $voc->getUriSpace());
397 400
                     }
401
+                    }
398 402
 
399 403
                 } catch (Exception $e) {
400 404
                     // not valid as namespace identifier, ignore
@@ -506,8 +510,9 @@  discard block
 block discarded – undo
506 510
         }
507 511
         
508 512
         foreach ($vocabs as $vocab) {
509
-            if ($vocab->getConceptLabel($uri, null) !== null)
510
-                return $vocab;
513
+            if ($vocab->getConceptLabel($uri, null) !== null) {
514
+                            return $vocab;
515
+            }
511 516
         }
512 517
 
513 518
         // if the URI couldn't be found, fall back to the first vocabulary
Please login to merge, or discard this patch.
model/VocabularyConfig.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 {
8 8
     private $plugins;
9 9
 
10
-    public function __construct($resource, $globalPlugins=array()) 
10
+    public function __construct($resource, $globalPlugins = array()) 
11 11
     {
12 12
         $this->resource = $resource;
13 13
         $plugins = $this->resource->allLiterals('skosmos:usePlugin');
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      * @param string $property the property to query
41 41
      * @param string $lang preferred language for the literal,
42 42
      */
43
-    private function getLiteral($property, $lang=null)
43
+    private function getLiteral($property, $lang = null)
44 44
     {
45 45
         if (!isset($lang)) {;
46 46
             $lang = $this->getEnvLang();
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
         $langs = $this->getLanguages();
73 73
         $deflang = reset($langs); // picking the first one from the list with reset since the keys are not numeric
74 74
         if (sizeof($langs) > 1) {
75
-            trigger_error("Default language for vocabulary '" . $this->getShortName() . "' unknown, choosing '$deflang'.", E_USER_WARNING);
75
+            trigger_error("Default language for vocabulary '".$this->getShortName()."' unknown, choosing '$deflang'.", E_USER_WARNING);
76 76
         }
77 77
 
78 78
         return $deflang;
Please login to merge, or discard this patch.
Braces   +18 added lines, -9 removed lines patch added patch discarded remove patch
@@ -53,8 +53,9 @@  discard block
 block discarded – undo
53 53
 
54 54
         // not found with selected language, try any language
55 55
         $literal = $this->resource->getLiteral($property);
56
-        if ($literal)
57
-          return $literal->getValue();
56
+        if ($literal) {
57
+                  return $literal->getValue();
58
+        }
58 59
     }
59 60
 
60 61
     /**
@@ -95,8 +96,9 @@  discard block
 block discarded – undo
95 96
     public function getShortName()
96 97
     {
97 98
         $shortname = $this->getLiteral('skosmos:shortName');
98
-        if ($shortname) 
99
-          return $shortname;
99
+        if ($shortname) {
100
+                  return $shortname;
101
+        }
100 102
 
101 103
         // if no shortname exists fall back to the id
102 104
         return $this->getId();
@@ -215,10 +217,12 @@  discard block
 block discarded – undo
215 217
         $ret = array();
216 218
         foreach ($resources as $res) {
217 219
             $prop = $res->getURI();
218
-            if (EasyRdf_Namespace::shorten($prop) !== null) // shortening property labels if possible
220
+            if (EasyRdf_Namespace::shorten($prop) !== null) {
221
+              // shortening property labels if possible
219 222
             {
220 223
                 $prop = EasyRdf_Namespace::shorten($prop);
221 224
             }
225
+            }
222 226
 
223 227
             $ret[] = $prop;
224 228
         }
@@ -235,10 +239,12 @@  discard block
 block discarded – undo
235 239
         $resources = $this->resource->allResources("skosmos:hasMultiLingualProperty");
236 240
         foreach ($resources as $res) {
237 241
             $prop = $res->getURI();
238
-            if (EasyRdf_Namespace::shorten($prop) !== null) // shortening property labels if possible
242
+            if (EasyRdf_Namespace::shorten($prop) !== null) {
243
+              // shortening property labels if possible
239 244
             {
240 245
                 $prop = EasyRdf_Namespace::shorten($prop);
241 246
             }
247
+            }
242 248
 
243 249
             if ($prop === $property) {
244 250
                 return true;
@@ -339,11 +345,12 @@  discard block
 block discarded – undo
339 345
     public function getId()
340 346
     {
341 347
         $uriparts = explode("#", $this->resource->getURI());
342
-        if (count($uriparts) != 1)
343
-        // hash namespace
348
+        if (count($uriparts) != 1) {
349
+                // hash namespace
344 350
         {
345 351
             return $uriparts[1];
346 352
         }
353
+        }
347 354
 
348 355
         // slash namespace
349 356
         $uriparts = explode("/", $this->resource->getURI());
@@ -371,10 +378,12 @@  discard block
 block discarded – undo
371 378
         $ret = array();
372 379
         foreach ($resources as $res) {
373 380
             $prop = $res->getURI();
374
-            if (EasyRdf_Namespace::shorten($prop) !== null) // prefixing if possible 
381
+            if (EasyRdf_Namespace::shorten($prop) !== null) {
382
+              // prefixing if possible 
375 383
             {
376 384
                 $prop = EasyRdf_Namespace::shorten($prop);
377 385
             }
386
+            }
378 387
 
379 388
             $ret[] = $prop;
380 389
         }
Please login to merge, or discard this patch.
model/PluginRegister.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 class PluginRegister {
4 4
     private $requestedPlugins;
5 5
 
6
-    public function __construct($requestedPlugins=array()) {
6
+    public function __construct($requestedPlugins = array()) {
7 7
         $this->requestedPlugins = $requestedPlugins;
8 8
     }
9 9
     
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
                 if (isset($files[$type])) {
39 39
                     $ret[$name] = array();
40 40
                     foreach ($files[$type] as $file) {
41
-                        array_push($ret[$name], 'plugins/' . $name . '/' . $file);
41
+                        array_push($ret[$name], 'plugins/'.$name.'/'.$file);
42 42
                     }
43 43
                 }
44 44
             } 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      * @param array $names the plugin name strings (foldernames) in an array 
69 69
      * @return array
70 70
      */
71
-    public function getPluginsJS($names=null) {
71
+    public function getPluginsJS($names = null) {
72 72
         if ($names) {
73 73
             $names = array_merge($this->requestedPlugins, $names);
74 74
             return $this->filterPluginsByName('js', $names);
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      * @param array $names the plugin name strings (foldernames) in an array 
82 82
      * @return array
83 83
      */
84
-    public function getPluginsCSS($names=null) {
84
+    public function getPluginsCSS($names = null) {
85 85
         if ($names) {
86 86
             $names = array_merge($this->requestedPlugins, $names);
87 87
             return $this->filterPluginsByName('css', $names);
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      * @param array $names the plugin name strings (foldernames) in an array 
95 95
      * @return array
96 96
      */
97
-    public function getPluginsTemplates($names=null) {
97
+    public function getPluginsTemplates($names = null) {
98 98
         if ($names) {
99 99
             $names = array_merge($this->requestedPlugins, $names);
100 100
             return $this->filterPluginsByName('templates', $names);
@@ -107,15 +107,15 @@  discard block
 block discarded – undo
107 107
      * @param array $names the plugin name strings (foldernames) in an array 
108 108
      * @return array
109 109
      */
110
-    public function getTemplates($names=null) {
110
+    public function getTemplates($names = null) {
111 111
         $templateStrings = array();
112 112
         $plugins = $this->getPluginsTemplates($names);
113 113
         foreach ($plugins as $folder => $templates) {
114 114
             foreach ($templates as $path) {
115 115
                 if (file_exists($path)) {
116 116
                     $filename = explode('/', $path);
117
-                    $filename = $filename[sizeof($filename)-1];
118
-                    $id = $folder . '-' . substr($filename, 0 , (strrpos($filename, ".")));
117
+                    $filename = $filename[sizeof($filename) - 1];
118
+                    $id = $folder.'-'.substr($filename, 0, (strrpos($filename, ".")));
119 119
                     $templateStrings[$id] = file_get_contents($path);
120 120
                 }
121 121
             }
Please login to merge, or discard this patch.
model/ConceptMappingPropertyValue.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
     {
23 23
         $label = $this->getLabel();
24 24
         $notation = $this->getNotation();
25
-        return $notation . $label;
25
+        return $notation.$label;
26 26
     }
27 27
 
28 28
     public function getType()
Please login to merge, or discard this patch.
controller/EntityController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
         $baseurl = $this->getBaseHref();
22 22
         $vocid = $vocab->getId();
23 23
         $query = http_build_query(array('uri'=>$uri, 'format'=>$targetFormat));
24
-        $url = $baseurl . "rest/v1/$vocid/data?$query";
24
+        $url = $baseurl."rest/v1/$vocid/data?$query";
25 25
         $this->redirect303($url);
26 26
     }
27 27
     
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
         $localname = $vocab->getLocalName($uri);
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
         $this->redirect303($url);
42 42
     }
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             // guess vocabulary based on URI
57 57
             $vocab = $this->model->guessVocabularyFromURI($request->getUri());
58 58
             if ($vocab === null) {
59
-                return $this->returnError('404', 'Not Found', 'Unrecognized URI ' . $request->getUri());
59
+                return $this->returnError('404', 'Not Found', 'Unrecognized URI '.$request->getUri());
60 60
             }
61 61
             $request->setVocab($vocab->getId());
62 62
         }
Please login to merge, or discard this patch.
controller/WebController.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
         // register a Twig filter for generating URLs for vocabulary resources (concepts and groups)
71 71
         $controller = $this; // for use by anonymous function below
72
-        $urlFilter = new Twig_SimpleFilter('link_url', function ($uri, $vocab, $lang, $type = 'page', $clang = null, $term = null) use ($controller) {
72
+        $urlFilter = new Twig_SimpleFilter('link_url', function($uri, $vocab, $lang, $type = 'page', $clang = null, $term = null) use ($controller) {
73 73
             // $vocab can either be null, a vocabulary id (string) or a Vocabulary object
74 74
             if ($vocab === null) {
75 75
                 // target vocabulary is unknown, best bet is to link to the plain URI
@@ -94,23 +94,23 @@  discard block
 block discarded – undo
94 94
             $localname = $vocab->getLocalName($uri);
95 95
             if ($localname !== $uri && $localname === urlencode($localname)) {
96 96
                 // check that the prefix stripping worked, and there are no problematic chars in localname
97
-                $paramstr = sizeof($params) > 0 ? '?' . http_build_query($params) : '';
97
+                $paramstr = sizeof($params) > 0 ? '?'.http_build_query($params) : '';
98 98
                 if ($type && $type !== '' && $type !== 'vocab') {
99
-                    return "$vocid/$lang/$type/$localname" . $paramstr;
99
+                    return "$vocid/$lang/$type/$localname".$paramstr;
100 100
                 }
101 101
 
102
-                return "$vocid/$lang/$localname" . $paramstr;
102
+                return "$vocid/$lang/$localname".$paramstr;
103 103
             }
104 104
 
105 105
             // case 2: URI outside vocabulary namespace, or has problematic chars
106 106
             // pass the full URI as parameter instead
107 107
             $params['uri'] = $uri;
108
-            return "$vocid/$lang/$type/?" . http_build_query($params);
108
+            return "$vocid/$lang/$type/?".http_build_query($params);
109 109
         });
110 110
         $this->twig->addFilter($urlFilter);
111 111
 
112 112
         // register a Twig filter for generating strings from language codes with CLDR
113
-        $langFilter = new Twig_SimpleFilter('lang_name', function ($langcode, $lang) {
113
+        $langFilter = new Twig_SimpleFilter('lang_name', function($langcode, $lang) {
114 114
             return Language::getName($langcode, $lang);
115 115
         });
116 116
         $this->twig->addFilter($langFilter);
@@ -251,12 +251,12 @@  discard block
 block discarded – undo
251 251
     private function createFeedbackHeaders($fromName, $fromEmail, $toMail)
252 252
     {
253 253
         $headers = "MIME-Version: 1.0″ . '\r\n";
254
-        $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";
254
+        $headers .= "Content-type: text/html; charset=UTF-8"."\r\n";
255 255
         if ($toMail) {
256
-            $headers .= "Cc: " . $this->model->getConfig()->getFeedbackAddress() . "\r\n";
256
+            $headers .= "Cc: ".$this->model->getConfig()->getFeedbackAddress()."\r\n";
257 257
         }
258 258
 
259
-        $headers .= "From: $fromName <$fromEmail>" . "\r\n" . 'X-Mailer: PHP/' . phpversion();
259
+        $headers .= "From: $fromName <$fromEmail>"."\r\n".'X-Mailer: PHP/'.phpversion();
260 260
         return $headers;
261 261
     }
262 262
 
@@ -271,20 +271,20 @@  discard block
 block discarded – undo
271 271
     {
272 272
         $toAddress = ($toMail) ? $toMail : $this->model->getConfig()->getFeedbackAddress();
273 273
         if ($fromVocab !== null) {
274
-            $message = 'Feedback from vocab: ' . strtoupper($fromVocab) . "<br />" . $message;
274
+            $message = 'Feedback from vocab: '.strtoupper($fromVocab)."<br />".$message;
275 275
         }
276 276
 
277
-        $subject = SERVICE_NAME . " feedback";
277
+        $subject = SERVICE_NAME." feedback";
278 278
         $headers = $this->createFeedbackHeaders($fromName, $fromEmail, $toMail);
279 279
         $envelopeSender = FEEDBACK_ENVELOPE_SENDER;
280 280
         $params = empty($envelopeSender) ? '' : "-f $envelopeSender";
281 281
 
282 282
         // adding some information about the user for debugging purposes.
283
-        $message = $message . "<br /><br /> Debugging information:"
284
-            . "<br />Timestamp: " . date(DATE_RFC2822)
285
-            . "<br />User agent: " . $request->getServerConstant('HTTP_USER_AGENT')
286
-            . "<br />IP address: " . $request->getServerConstant('REMOTE_ADDR')
287
-            . "<br />Referer: " . $request->getServerConstant('HTTP_REFERER');
283
+        $message = $message."<br /><br /> Debugging information:"
284
+            . "<br />Timestamp: ".date(DATE_RFC2822)
285
+            . "<br />User agent: ".$request->getServerConstant('HTTP_USER_AGENT')
286
+            . "<br />IP address: ".$request->getServerConstant('REMOTE_ADDR')
287
+            . "<br />Referer: ".$request->getServerConstant('HTTP_REFERER');
288 288
 
289 289
         try {
290 290
             mail($toAddress, $subject, $message, $headers, $params);
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
             header("HTTP/1.0 404 Not Found");
293 293
             $template = $this->twig->loadTemplate('error-page.twig');
294 294
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
295
-                error_log('Caught exception: ' . $e->getMessage());
295
+                error_log('Caught exception: '.$e->getMessage());
296 296
             }
297 297
 
298 298
             echo $template->render(
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
         $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : null;
340 340
         $vocabObjects = array();
341 341
         if ($vocids) {
342
-            foreach($vocids as $vocid) {
342
+            foreach ($vocids as $vocid) {
343 343
                 $vocabObjects[] = $this->model->getVocabulary($vocid);
344 344
             }
345 345
         }
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
         } catch (Exception $e) {
351 351
             header("HTTP/1.0 404 Not Found");
352 352
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
353
-                error_log('Caught exception: ' . $e->getMessage());
353
+                error_log('Caught exception: '.$e->getMessage());
354 354
             }
355 355
             $this->invokeGenericErrorPage($request, $e->getMessage());
356 356
             return;
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
                 'search_count' => $counts,
367 367
                 'languages' => $this->languages,
368 368
                 'search_results' => $search_results,
369
-                'rest' => $parameters->getOffset()>0,
369
+                'rest' => $parameters->getOffset() > 0,
370 370
                 'global_search' => true,
371 371
                 'term' => $request->getQueryParam('q'),
372 372
                 'lang_list' => $langList,
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
         } catch (Exception $e) {
392 392
             header("HTTP/1.0 404 Not Found");
393 393
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
394
-                error_log('Caught exception: ' . $e->getMessage());
394
+                error_log('Caught exception: '.$e->getMessage());
395 395
             }
396 396
 
397 397
             echo $template->render(
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
         } catch (Exception $e) {
413 413
             header("HTTP/1.0 404 Not Found");
414 414
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
415
-                error_log('Caught exception: ' . $e->getMessage());
415
+                error_log('Caught exception: '.$e->getMessage());
416 416
             }
417 417
 
418 418
             echo $template->render(
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
                 'vocab' => $vocab,
430 430
                 'search_results' => $search_results,
431 431
                 'search_count' => $counts,
432
-                'rest' => $parameters->getOffset()>0,
432
+                'rest' => $parameters->getOffset() > 0,
433 433
                 'limit_parent' => $parameters->getParentLimit(),
434 434
                 'limit_type' =>  $request->getQueryParam('type') ? explode('+', $request->getQueryParam('type')) : null,
435 435
                 'limit_group' => $parameters->getGroupLimit(),
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
      * Loads and renders the view containing a list of recent changes in the vocabulary.
555 555
      * @param Request $request
556 556
      */
557
-    public function invokeChangeList($request, $prop='dc:created')
557
+    public function invokeChangeList($request, $prop = 'dc:created')
558 558
     {
559 559
         // set language parameters for gettext
560 560
         $this->setLanguageProperties($request->getLang());
Please login to merge, or discard this patch.
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -248,6 +248,10 @@  discard block
 block discarded – undo
248 248
             ));
249 249
     }
250 250
 
251
+    /**
252
+     * @param string|null $fromName
253
+     * @param string|null $fromEmail
254
+     */
251 255
     private function createFeedbackHeaders($fromName, $fromEmail, $toMail)
252 256
     {
253 257
         $headers = "MIME-Version: 1.0″ . '\r\n";
@@ -535,6 +539,7 @@  discard block
 block discarded – undo
535 539
 
536 540
     /**
537 541
      * Invokes a very generic errorpage.
542
+     * @param string $message
538 543
      */
539 544
     public function invokeGenericErrorPage($request, $message = null)
540 545
     {
Please login to merge, or discard this patch.
model/sparql/GenericSparql.php 3 patches
Braces   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -64,12 +64,16 @@  discard block
 block discarded – undo
64 64
         $this->model = $model;
65 65
 
66 66
         // set graphClause so that it can be used by all queries
67
-        if ($this->isDefaultEndpoint()) // default endpoint; query any graph (and catch it in a variable)
67
+        if ($this->isDefaultEndpoint()) {
68
+          // default endpoint; query any graph (and catch it in a variable)
68 69
         {
69 70
             $this->graphClause = "GRAPH $graph";
70
-        } elseif ($graph) // query a specific graph
71
+        }
72
+        } elseif ($graph) {
73
+          // query a specific graph
71 74
         {
72 75
             $this->graphClause = "GRAPH <$graph>";
76
+        }
73 77
         } else // query the default graph
74 78
         {
75 79
             $this->graphClause = "";
@@ -1711,8 +1715,7 @@  discard block
 block discarded – undo
1711 1715
         if (sizeof($ret) > 0) {
1712 1716
             // existing concept, with children
1713 1717
             return $ret;
1714
-        }
1715
-        else {
1718
+        } else {
1716 1719
             // nonexistent concept
1717 1720
             return null;
1718 1721
         }
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
      * @param Vocabulary[]|null $vocabs
66 66
      * @return string
67 67
      */
68
-    protected function generateFromClause($vocabs=null) {
68
+    protected function generateFromClause($vocabs = null) {
69 69
         $graphs = array();
70 70
         $clause = '';
71 71
         if (!$vocabs) {
72 72
             return $this->graph !== '?graph' ? "FROM <$this->graph>" : '';
73 73
         }
74
-        foreach($vocabs as $vocab) {
74
+        foreach ($vocabs as $vocab) {
75 75
             $graph = $vocab->getGraph();
76 76
             if (!in_array($graph, $graphs)) {
77 77
                 array_push($graphs, $graph);
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
         foreach ($graphs as $graph) {
675 675
           $values[] = "<$graph>";
676 676
         }
677
-        return "FILTER (?graph IN (" . implode(',', $values) . "))";
677
+        return "FILTER (?graph IN (".implode(',', $values)."))";
678 678
     }
679 679
 
680 680
     /**
@@ -684,16 +684,16 @@  discard block
 block discarded – undo
684 684
      * @return string sparql query clauses
685 685
      */
686 686
     protected function formatLimitAndOffset($limit, $offset) {
687
-        $limit = ($limit) ? 'LIMIT ' . $limit : '';
688
-        $offset = ($offset) ? 'OFFSET ' . $offset : '';
687
+        $limit = ($limit) ? 'LIMIT '.$limit : '';
688
+        $offset = ($offset) ? 'OFFSET '.$offset : '';
689 689
         // eliminating whitespace and line changes when the conditions aren't needed.
690 690
         $limitandoffset = '';
691 691
         if ($limit && $offset) {
692
-            $limitandoffset = "\n" . $limit . "\n" . $offset;
692
+            $limitandoffset = "\n".$limit."\n".$offset;
693 693
         } elseif ($limit) {
694
-            $limitandoffset = "\n" . $limit;
694
+            $limitandoffset = "\n".$limit;
695 695
         } elseif ($offset) {
696
-            $limitandoffset = "\n" . $offset;
696
+            $limitandoffset = "\n".$offset;
697 697
         }
698 698
 
699 699
         return $limitandoffset;
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
             }
714 714
         }
715 715
 
716
-        return implode(' UNION ', $typePatterns);;
716
+        return implode(' UNION ', $typePatterns); ;
717 717
     }
718 718
 
719 719
     /**
@@ -845,14 +845,14 @@  discard block
 block discarded – undo
845 845
         // if search language and UI/display language differ, must also consider case where there is no prefLabel in
846 846
         // the display language; in that case, should use the label with the same language as the matched label
847 847
         $labelcondFallback = ($searchLang != $lang) ?
848
-          "OPTIONAL { # in case previous OPTIONAL block gives no labels\n" .
848
+          "OPTIONAL { # in case previous OPTIONAL block gives no labels\n".
849 849
           "?s skos:prefLabel ?label . FILTER (LANGMATCHES(LANG(?label), LANG(?match))) }" : "";
850 850
           
851 851
         //  Including the labels if there is no query term given.
852 852
         if ($rawterm === '') {
853 853
           $labelClause = "?s skos:prefLabel ?label .";
854
-          $labelClause = ($lang) ? $labelClause . " FILTER (LANGMATCHES(LANG(?label), '$lang'))" : $labelClause . "";
855
-          return $labelClause . " BIND(?label AS ?match)";
854
+          $labelClause = ($lang) ? $labelClause." FILTER (LANGMATCHES(LANG(?label), '$lang'))" : $labelClause."";
855
+          return $labelClause." BIND(?label AS ?match)";
856 856
         }
857 857
 
858 858
         /*
@@ -912,15 +912,15 @@  discard block
 block discarded – undo
912 912
 
913 913
         $schemecond = '';
914 914
         if (!empty($schemes)) {
915
-            foreach($schemes as $scheme) {
915
+            foreach ($schemes as $scheme) {
916 916
                 $schemecond .= "?s skos:inScheme <$scheme> . ";
917 917
             }
918 918
         }
919 919
 
920 920
         // extra conditions for parent and group, if specified
921
-        $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <" . $params->getParentLimit() . "> ." : "";
922
-        $groupcond = ($params->getGroupLimit()) ? "<" . $params->getGroupLimit() . "> skos:member ?s ." : "";
923
-        $pgcond = $parentcond . $groupcond;
921
+        $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <".$params->getParentLimit()."> ." : "";
922
+        $groupcond = ($params->getGroupLimit()) ? "<".$params->getGroupLimit()."> skos:member ?s ." : "";
923
+        $pgcond = $parentcond.$groupcond;
924 924
 
925 925
         $orderextra = $this->isDefaultEndpoint() ? $this->graph : '';
926 926
 
@@ -994,9 +994,9 @@  discard block
 block discarded – undo
994 994
             $hit['type'][] = $this->shortenUri($typeuri);
995 995
         }
996 996
 
997
-        if(!empty($fields)) {
997
+        if (!empty($fields)) {
998 998
             foreach ($fields as $prop) {
999
-                $propname = $prop . 's';
999
+                $propname = $prop.'s';
1000 1000
                 if (isset($row->$propname)) {
1001 1001
                     foreach (explode("\n", $row->$propname->getValue()) as $line) {
1002 1002
                         $rdata = str_getcsv($line, ',', '"', '"');
@@ -1011,7 +1011,7 @@  discard block
 block discarded – undo
1011 1011
                             $propvals = $rdata[2];
1012 1012
                         }
1013 1013
 
1014
-                        $hit['skos:' . $prop][] = $propvals;
1014
+                        $hit['skos:'.$prop][] = $propvals;
1015 1015
                     }
1016 1016
                 }
1017 1017
             }
@@ -1472,7 +1472,7 @@  discard block
 block discarded – undo
1472 1472
                 if (!isset($row->label) || $row->label->getLang() === $lang) {
1473 1473
                     $ret[$row->object->getUri()] = $val;
1474 1474
                 } elseif ($row->label->getLang() === $fallbacklang) {
1475
-                    $val['label'] .= ' (' . $row->label->getLang() . ')';
1475
+                    $val['label'] .= ' ('.$row->label->getLang().')';
1476 1476
                     $ret[$row->object->getUri()] = $val;
1477 1477
                 }
1478 1478
             }
@@ -1571,7 +1571,7 @@  discard block
 block discarded – undo
1571 1571
                 if ($row->label->getLang() == $lang) {
1572 1572
                     $label = $row->label->getValue();
1573 1573
                 } else {
1574
-                    $label = $row->label->getValue() . " (" . $row->label->getLang() . ")";
1574
+                    $label = $row->label->getValue()." (".$row->label->getLang().")";
1575 1575
                 }
1576 1576
 
1577 1577
             }
@@ -1736,7 +1736,7 @@  discard block
 block discarded – undo
1736 1736
                 if (isset($row->childlabel)) {
1737 1737
                     $label = $row->childlabel->getValue();
1738 1738
                     if ($row->childlabel->getLang() !== $lang) {
1739
-                        $label .= " (" . $row->childlabel->getLang() . ")";
1739
+                        $label .= " (".$row->childlabel->getLang().")";
1740 1740
                     }
1741 1741
 
1742 1742
                 }
@@ -1758,7 +1758,7 @@  discard block
 block discarded – undo
1758 1758
             if (isset($row->label)) {
1759 1759
                 $preflabel = $row->label->getValue();
1760 1760
                 if ($row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang) !== 0) {
1761
-                    $preflabel .= ' (' . $row->label->getLang() . ')';
1761
+                    $preflabel .= ' ('.$row->label->getLang().')';
1762 1762
                 }
1763 1763
 
1764 1764
                 $ret[$uri]['prefLabel'] = $preflabel;
@@ -1918,7 +1918,7 @@  discard block
 block discarded – undo
1918 1918
                     if ($row->label->getLang() == $lang) {
1919 1919
                         $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue();
1920 1920
                     } else {
1921
-                        $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue() . " (" . $row->label->getLang() . ")";
1921
+                        $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue()." (".$row->label->getLang().")";
1922 1922
                     }
1923 1923
 
1924 1924
                 }
@@ -1959,7 +1959,7 @@  discard block
 block discarded – undo
1959 1959
      */
1960 1960
     private function generateChangeListQuery($lang, $offset, $prop) {
1961 1961
         $fcl = $this->generateFromClause();
1962
-        $offset = ($offset) ? 'OFFSET ' . $offset : '';
1962
+        $offset = ($offset) ? 'OFFSET '.$offset : '';
1963 1963
 
1964 1964
         $query = <<<EOQ
1965 1965
 SELECT DISTINCT ?concept ?date ?label $fcl
Please login to merge, or discard this patch.
Doc Comments   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
      * Returns information (as a graph) for one or more concept URIs
430 430
      * @param mixed $uris concept URI (string) or array of URIs
431 431
      * @param string|null $arrayClass the URI for thesaurus array class, or null if not used
432
-     * @param \Vocabulary[]|null $vocabs vocabularies to target
432
+     * @param Vocabulary[] $vocabs vocabularies to target
433 433
      * @return \Concept[]
434 434
      */
435 435
     public function queryConceptInfoGraph($uris, $arrayClass = null, $vocabs = array()) {
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
 
650 650
     /**
651 651
      * Generate a VALUES clause for limiting the targeted graphs.
652
-     * @param Vocabulary[]|null $vocabs array of Vocabulary objects to target
652
+     * @param Vocabulary[] $vocabs array of Vocabulary objects to target
653 653
      * @return string VALUES clause, or "" if not necessary to limit
654 654
      */
655 655
     protected function formatValuesGraph($vocabs) {
@@ -829,6 +829,7 @@  discard block
 block discarded – undo
829 829
      * @param string $searchLang language code used for matching labels (null means any language)
830 830
      * @param string[] $props properties to target e.g. array('skos:prefLabel','skos:altLabel')
831 831
      * @param boolean $unique restrict results to unique concepts (default: false)
832
+     * @param string $filterGraph
832 833
      * @return string sparql query
833 834
      */
834 835
     protected function generateConceptSearchQueryInner($term, $lang, $searchLang, $props, $unique, $filterGraph)
@@ -1094,6 +1095,7 @@  discard block
 block discarded – undo
1094 1095
     /**
1095 1096
      * Generates sparql query clauses used for creating the alphabetical index.
1096 1097
      * @param string $letter the letter (or special class) to search for
1098
+     * @param string $lang
1097 1099
      * @return array of sparql query clause strings
1098 1100
      */
1099 1101
     private function formatFilterConditions($letter, $lang) {
@@ -1406,7 +1408,7 @@  discard block
 block discarded – undo
1406 1408
     /**
1407 1409
      * Query a single transitive property of a concept.
1408 1410
      * @param string $uri
1409
-     * @param string $prop the name of the property eg. 'skos:broader'.
1411
+     * @param string $props the name of the property eg. 'skos:broader'.
1410 1412
      * @param string $lang
1411 1413
      * @param integer $limit
1412 1414
      * @param boolean $anylang if you want a label even when it isn't available in the language you requested.
Please login to merge, or discard this patch.
model/sparql/JenaTextSparql.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         // 1. Ensure characters with special meaning in Lucene are escaped
45 45
         $lucenemap = array();
46 46
         foreach (str_split(self::LUCENE_ESCAPE_CHARS) as $char) {
47
-            $lucenemap[$char] = '\\' . $char; // escape with a backslash
47
+            $lucenemap[$char] = '\\'.$char; // escape with a backslash
48 48
         }
49 49
         $term = strtr($term, $lucenemap);
50 50
 
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 
103 103
         # make text query clause
104 104
         $lcletter = mb_strtolower($letter, 'UTF-8'); // convert to lower case, UTF-8 safe
105
-        $textcondPref = $this->createTextQueryCondition($letter . '*', 'skos:prefLabel', $lang);
106
-        $textcondAlt = $this->createTextQueryCondition($letter . '*', 'skos:altLabel', $lang);
105
+        $textcondPref = $this->createTextQueryCondition($letter.'*', 'skos:prefLabel', $lang);
106
+        $textcondAlt = $this->createTextQueryCondition($letter.'*', 'skos:altLabel', $lang);
107 107
 
108 108
         $query = <<<EOQ
109 109
 SELECT DISTINCT ?s ?label ?alabel
Please login to merge, or discard this patch.
entity.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,5 +23,5 @@
 block discarded – undo
23 23
 
24 24
 } catch (Exception $e) {
25 25
     header("HTTP/1.0 500 Internal Server Error");
26
-    echo('ERROR: ' . $e->getMessage());
26
+    echo('ERROR: '.$e->getMessage());
27 27
 }
Please login to merge, or discard this patch.