Completed
Pull Request — master (#846)
by
unknown
01:52
created
model/ConceptMappingPropertyValue.php 2 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -169,6 +169,8 @@
 block discarded – undo
169 169
 
170 170
     /**
171 171
      * Return the mapping as a JSKOS-compatible array.
172
+     * @param string $lang
173
+     * @param string $hrefLink
172 174
      * @return array
173 175
      */
174 176
     public function asJskos($queryExVocabs = true, $lang = null, $hrefLink = null)
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     {
37 37
         $label = $this->getLabel();
38 38
         $notation = $this->getNotation();
39
-        return $notation . $label;
39
+        return $notation.$label;
40 40
     }
41 41
 
42 42
     public function getType()
@@ -188,42 +188,42 @@  discard block
 block discarded – undo
188 188
             'from' => [
189 189
                 'memberSet' => [
190 190
                     [
191
-                        'uri' => (string) $this->source->getUri(),
191
+                        'uri' => (string)$this->source->getUri(),
192 192
                     ]
193 193
                 ]
194 194
             ],
195 195
             'to' => [
196 196
                 'memberSet' => [
197 197
                     [
198
-                        'uri' => (string) $this->getUri()
198
+                        'uri' => (string)$this->getUri()
199 199
                     ]
200 200
                 ]
201 201
             ],
202 202
             // EXTRA
203
-            'description' => gettext($this->type . "_help"), // pop-up text
203
+            'description' => gettext($this->type."_help"), // pop-up text
204 204
             'hrefLink' => $hrefLink, // link to resource as displayed in the UI
205 205
             'lang' => $propertyLang, // TBD: could it be part of the prefLabel?
206
-            'vocabName' => (string) $this->getVocabName(), // vocabulary as displayed in the UI
206
+            'vocabName' => (string)$this->getVocabName(), // vocabulary as displayed in the UI
207 207
             'typeLabel' => gettext($this->type), // a text used in the UI instead of, for example, skos:closeMatch
208 208
         ];
209 209
 
210 210
         $fromScheme = $this->vocab->getDefaultConceptScheme();
211 211
         if (isset($fromScheme)) {
212 212
             $ret['fromScheme'] = [
213
-                'uri' => (string) $fromScheme,
213
+                'uri' => (string)$fromScheme,
214 214
             ];
215 215
         }
216 216
 
217 217
         $exvocab = $this->getExvocab();
218 218
         if (isset($exvocab)) {
219 219
             $ret['toScheme'] = [
220
-                'uri' => (string) $exvocab->getDefaultConceptScheme(),
220
+                'uri' => (string)$exvocab->getDefaultConceptScheme(),
221 221
             ];
222 222
         }
223 223
 
224 224
         $notation = $this->getNotation();
225 225
         if (isset($notation)) {
226
-            $ret['to']['memberSet'][0]['notation'] = (string) $notation;
226
+            $ret['to']['memberSet'][0]['notation'] = (string)$notation;
227 227
         }
228 228
 
229 229
         $label = $this->getLabel(null, $queryExVocabs);
Please login to merge, or discard this patch.
controller/RestController.php 1 patch
Doc Comments   +35 added lines patch added patch discarded remove patch
@@ -97,6 +97,9 @@  discard block
 block discarded – undo
97 97
         return $this->returnJson($ret);
98 98
     }
99 99
 
100
+    /**
101
+     * @param Request $request
102
+     */
100 103
     private function constructSearchParameters($request)
101 104
     {
102 105
         $parameters = new ConceptSearchParameters($request, $this->model->getConfig(), true);
@@ -112,6 +115,10 @@  discard block
 block discarded – undo
112 115
         return $parameters;
113 116
     }
114 117
 
118
+    /**
119
+     * @param Request $request
120
+     * @param ConceptSearchParameters $parameters
121
+     */
115 122
     private function transformSearchResults($request, $results, $parameters)
116 123
     {
117 124
         // before serializing to JSON, get rid of the Vocabulary object that came with each resource
@@ -407,6 +414,10 @@  discard block
 block discarded – undo
407 414
         return $this->returnJson($ret);
408 415
     }
409 416
 
417
+    /**
418
+     * @param string $label
419
+     * @param string $lang
420
+     */
410 421
     private function findLookupHits($results, $label, $lang)
411 422
     {
412 423
         $hits = array();
@@ -468,6 +479,9 @@  discard block
 block discarded – undo
468 479
         return $hits;
469 480
     }
470 481
 
482
+    /**
483
+     * @param string $lang
484
+     */
471 485
     private function transformLookupResults($lang, $hits)
472 486
     {
473 487
         if (sizeof($hits) == 0) {
@@ -539,6 +553,9 @@  discard block
 block discarded – undo
539 553
         return $this->returnJson($ret);
540 554
     }
541 555
 
556
+    /**
557
+     * @param Request $request
558
+     */
542 559
     private function redirectToVocabData($request) {
543 560
         $urls = $request->getVocab()->getConfig()->getDataURLs();
544 561
         if (sizeof($urls) == 0) {
@@ -554,6 +571,10 @@  discard block
 block discarded – undo
554 571
         header("Location: " . $urls[$format]);
555 572
     }
556 573
 
574
+    /**
575
+     * @param string $results
576
+     * @param string $format
577
+     */
557 578
     private function returnDataResults($results, $format) {
558 579
         if ($format == 'application/ld+json' || $format == 'application/json') {
559 580
             // further compact JSON-LD document using a context
@@ -683,6 +704,12 @@  discard block
 block discarded – undo
683 704
         return $this->returnJson($ret);
684 705
     }
685 706
 
707
+    /**
708
+     * @param string $uri
709
+     * @param string $lang
710
+     * @param string $propname
711
+     * @param string $propuri
712
+     */
686 713
     private function transformPropertyResults($uri, $lang, $objects, $propname, $propuri)
687 714
     {
688 715
         $results = array();
@@ -698,6 +725,14 @@  discard block
 block discarded – undo
698 725
         return $ret;
699 726
     }
700 727
 
728
+    /**
729
+     * @param string $uri
730
+     * @param string $lang
731
+     * @param string $tpropname
732
+     * @param string $tpropuri
733
+     * @param string $dpropname
734
+     * @param string $dpropuri
735
+     */
701 736
     private function transformTransitivePropertyResults($uri, $lang, $objects, $tpropname, $tpropuri, $dpropname, $dpropuri)
702 737
     {
703 738
         $results = array();
Please login to merge, or discard this patch.
controller/WebController.php 2 patches
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -269,6 +269,11 @@  discard block
 block discarded – undo
269 269
             ));
270 270
     }
271 271
 
272
+    /**
273
+     * @param string $fromName
274
+     * @param string|null $fromEmail
275
+     * @param string $sender
276
+     */
272 277
     private function createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender)
273 278
     {
274 279
         $headers = "MIME-Version: 1.0″ . '\r\n";
@@ -291,6 +296,7 @@  discard block
 block discarded – undo
291 296
      * @param string $fromName senders own name.
292 297
      * @param string $fromEmail senders email adress.
293 298
      * @param string $fromVocab which vocabulary is the feedback related to.
299
+     * @param string $toMail
294 300
      */
295 301
     public function sendFeedback($request, $message, $fromName = null, $fromEmail = null, $fromVocab = null, $toMail = null)
296 302
     {
@@ -571,6 +577,7 @@  discard block
 block discarded – undo
571 577
 
572 578
     /**
573 579
      * Invokes a very generic errorpage.
580
+     * @param string $message
574 581
      */
575 582
     public function invokeGenericErrorPage($request, $message = null)
576 583
     {
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 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);
@@ -272,9 +272,9 @@  discard block
 block discarded – undo
272 272
     private function createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender)
273 273
     {
274 274
         $headers = "MIME-Version: 1.0″ . '\r\n";
275
-        $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";
275
+        $headers .= "Content-type: text/html; charset=UTF-8"."\r\n";
276 276
         if (!empty($toMail)) {
277
-            $headers .= "Cc: " . $this->model->getConfig()->getFeedbackAddress() . "\r\n";
277
+            $headers .= "Cc: ".$this->model->getConfig()->getFeedbackAddress()."\r\n";
278 278
         }
279 279
         if (!empty($fromEmail)) {
280 280
             $headers .= "Reply-To: $fromName <$fromEmail>\r\n";
@@ -296,11 +296,11 @@  discard block
 block discarded – undo
296 296
     {
297 297
         $toAddress = ($toMail) ? $toMail : $this->model->getConfig()->getFeedbackAddress();
298 298
         if ($fromVocab !== null && $fromVocab !== '') {
299
-            $message = 'Feedback from vocab: ' . strtoupper($fromVocab) . "<br />" . $message;
299
+            $message = 'Feedback from vocab: '.strtoupper($fromVocab)."<br />".$message;
300 300
         }
301 301
 
302 302
         $envelopeSender = $this->model->getConfig()->getFeedbackEnvelopeSender();
303
-        $subject = $this->model->getConfig()->getServiceName() . " feedback";
303
+        $subject = $this->model->getConfig()->getServiceName()." feedback";
304 304
         // determine the sender address of the message
305 305
         $sender = $this->model->getConfig()->getFeedbackSender();
306 306
         if (empty($sender)) $sender = $envelopeSender;
@@ -313,10 +313,10 @@  discard block
 block discarded – undo
313 313
         $params = empty($envelopeSender) ? '' : "-f $envelopeSender";
314 314
 
315 315
         // adding some information about the user for debugging purposes.
316
-        $message = $message . "<br /><br /> Debugging information:"
317
-            . "<br />Timestamp: " . date(DATE_RFC2822)
318
-            . "<br />User agent: " . $request->getServerConstant('HTTP_USER_AGENT')
319
-            . "<br />Referer: " . $request->getServerConstant('HTTP_REFERER');
316
+        $message = $message."<br /><br /> Debugging information:"
317
+            . "<br />Timestamp: ".date(DATE_RFC2822)
318
+            . "<br />User agent: ".$request->getServerConstant('HTTP_USER_AGENT')
319
+            . "<br />Referer: ".$request->getServerConstant('HTTP_REFERER');
320 320
 
321 321
         try {
322 322
             mail($toAddress, $subject, $message, $headers, $params);
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
             header("HTTP/1.0 404 Not Found");
325 325
             $template = $this->twig->loadTemplate('error-page.twig');
326 326
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
327
-                error_log('Caught exception: ' . $e->getMessage());
327
+                error_log('Caught exception: '.$e->getMessage());
328 328
             }
329 329
 
330 330
             echo $template->render(
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
         $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : null;
372 372
         $vocabObjects = array();
373 373
         if ($vocids) {
374
-            foreach($vocids as $vocid) {
374
+            foreach ($vocids as $vocid) {
375 375
                 $vocabObjects[] = $this->model->getVocabulary($vocid);
376 376
             }
377 377
         }
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
         } catch (Exception $e) {
383 383
             header("HTTP/1.0 404 Not Found");
384 384
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
385
-                error_log('Caught exception: ' . $e->getMessage());
385
+                error_log('Caught exception: '.$e->getMessage());
386 386
             }
387 387
             $this->invokeGenericErrorPage($request, $e->getMessage());
388 388
             return;
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
                 'search_count' => $counts,
399 399
                 'languages' => $this->languages,
400 400
                 'search_results' => $searchResults,
401
-                'rest' => $parameters->getOffset()>0,
401
+                'rest' => $parameters->getOffset() > 0,
402 402
                 'global_search' => true,
403 403
                 'term' => $request->getQueryParamRaw('q'),
404 404
                 'lang_list' => $langList,
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
         } catch (Exception $e) {
424 424
             header("HTTP/1.0 404 Not Found");
425 425
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
426
-                error_log('Caught exception: ' . $e->getMessage());
426
+                error_log('Caught exception: '.$e->getMessage());
427 427
             }
428 428
 
429 429
             echo $template->render(
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
         } catch (Exception $e) {
445 445
             header("HTTP/1.0 404 Not Found");
446 446
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
447
-                error_log('Caught exception: ' . $e->getMessage());
447
+                error_log('Caught exception: '.$e->getMessage());
448 448
             }
449 449
 
450 450
             echo $template->render(
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
                 'vocab' => $vocab,
462 462
                 'search_results' => $searchResults,
463 463
                 'search_count' => $counts,
464
-                'rest' => $parameters->getOffset()>0,
464
+                'rest' => $parameters->getOffset() > 0,
465 465
                 'limit_parent' => $parameters->getParentLimit(),
466 466
                 'limit_type' =>  $request->getQueryParam('type') ? explode('+', $request->getQueryParam('type')) : null,
467 467
                 'limit_group' => $parameters->getGroupLimit(),
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
      * Loads and renders the view containing a list of recent changes in the vocabulary.
591 591
      * @param Request $request
592 592
      */
593
-    public function invokeChangeList($request, $prop='dc:created')
593
+    public function invokeChangeList($request, $prop = 'dc:created')
594 594
     {
595 595
         // set language parameters for gettext
596 596
         $this->setLanguageProperties($request->getLang());
Please login to merge, or discard this patch.
controller/Controller.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -142,18 +142,18 @@  discard block
 block discarded – undo
142 142
         $localname = $vocab->getLocalName($uri);
143 143
         if ($localname !== $uri && $localname === urlencode($localname)) {
144 144
             // check that the prefix stripping worked, and there are no problematic chars in localname
145
-            $paramstr = sizeof($params) > 0 ? '?' . http_build_query($params) : '';
145
+            $paramstr = sizeof($params) > 0 ? '?'.http_build_query($params) : '';
146 146
             if ($type && $type !== '' && $type !== 'vocab' && !($localname === '' && $type === 'page')) {
147
-                return "$vocid/$lang/$type/$localname" . $paramstr;
147
+                return "$vocid/$lang/$type/$localname".$paramstr;
148 148
             }
149 149
 
150
-            return "$vocid/$lang/$localname" . $paramstr;
150
+            return "$vocid/$lang/$localname".$paramstr;
151 151
         }
152 152
 
153 153
         // case 2: URI outside vocabulary namespace, or has problematic chars
154 154
         // pass the full URI as parameter instead
155 155
         $params['uri'] = $uri;
156
-        return "$vocid/$lang/$type/?" . http_build_query($params);
156
+        return "$vocid/$lang/$type/?".http_build_query($params);
157 157
     }
158 158
 
159 159
     /**
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
     {
188 188
         if ($modifiedDate) {
189 189
             $ifModifiedSince = $this->getIfModifiedSince();
190
-            $this->sendHeader("Last-Modified: " . $modifiedDate->format('Y-m-d H:i:s'));
190
+            $this->sendHeader("Last-Modified: ".$modifiedDate->format('Y-m-d H:i:s'));
191 191
             if (!is_null($ifModifiedSince) && $ifModifiedSince >= $modifiedDate) {
192 192
                 $this->sendHeader("HTTP/1.0 304 Not Modified");
193 193
                 return true;
Please login to merge, or discard this patch.