Completed
Push — master ( eb3b50...e1e7fd )
by Henri
03:00
created
model/ConceptPropertyValueLiteral.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
                 return Punic\Calendar::formatDate($val, 'short');
45 45
             } catch (Exception $e) {
46 46
                 trigger_error($e->getMessage(), E_USER_WARNING);
47
-                return (string) $this->literal;
47
+                return (string)$this->literal;
48 48
             }
49 49
         }
50 50
         return $this->literal->getValue();
Please login to merge, or discard this patch.
model/VocabularyCategory.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -10,6 +10,9 @@
 block discarded – undo
10 10
  */
11 11
 class VocabularyCategory extends DataObject
12 12
 {
13
+    /**
14
+     * @param Model $model
15
+     */
13 16
     public function __construct($model, $resource)
14 17
     {
15 18
         if (!($model instanceof Model)) {
Please login to merge, or discard this patch.
model/GlobalConfig.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -23,6 +23,9 @@
 block discarded – undo
23 23
         }
24 24
     }
25 25
     
26
+    /**
27
+     * @param string $name
28
+     */
26 29
     private function getConstant($name, $default)
27 30
     {
28 31
         if (defined($name) && constant($name)) {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,10 +6,10 @@  discard block
 block discarded – undo
6 6
 class GlobalConfig {
7 7
     private $languages;
8 8
 
9
-    public function __construct($config_name='/../config.inc') 
9
+    public function __construct($config_name = '/../config.inc') 
10 10
     {
11 11
         try {
12
-            $file_path = dirname(__FILE__) . $config_name;
12
+            $file_path = dirname(__FILE__).$config_name;
13 13
             if (!file_exists($file_path)) {
14 14
                 throw new Exception('config.inc file is missing, please provide one.');
15 15
             }
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
                 $this->languages = $LANGUAGES;
19 19
             }
20 20
         } catch (Exception $e) {
21
-            echo "Error: " . $e->getMessage();
21
+            echo "Error: ".$e->getMessage();
22 22
             return;
23 23
         }
24 24
     }
Please login to merge, or discard this patch.
model/Concept.php 2 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -55,6 +55,7 @@  discard block
 block discarded – undo
55 55
      * @param Vocabulary $vocab
56 56
      * @param EasyRdf_Resource $resource
57 57
      * @param EasyRdf_Graph $graph
58
+     * @param string|null $clang
58 59
      */
59 60
     public function __construct($model, $vocab, $resource, $graph, $clang)
60 61
     {
@@ -512,6 +513,7 @@  discard block
 block discarded – undo
512 513
 
513 514
     /**
514 515
      * Gets the groups/arrays the concept belongs to.
516
+     * @param boolean $includeArrays
515 517
      */
516 518
     public function getReverseResources($includeArrays) {
517 519
         $groups = array();
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -122,12 +122,12 @@  discard block
 block discarded – undo
122 122
         // 3. label in any language
123 123
         $label = $this->resource->label();
124 124
         // if the label lang code is a subset of the ui lang eg. en-GB
125
-        if ($label !== null && strpos($label->getLang(), $lang . '-') === 0) {
125
+        if ($label !== null && strpos($label->getLang(), $lang.'-') === 0) {
126 126
             return EasyRdf_Literal::create($label, $lang);
127 127
         }
128 128
 
129 129
         if ($label !== null) {
130
-            return $label->getLang() ? $label->getValue() . " (" . $label->getLang() . ")" : $label->getValue();
130
+            return $label->getLang() ? $label->getValue()." (".$label->getLang().")" : $label->getValue();
131 131
         }
132 132
 
133 133
         // empty
@@ -452,14 +452,14 @@  discard block
 block discarded – undo
452 452
 
453 453
             // making a human readable string from the timestamps
454 454
             if ($created != '') {
455
-                $ret = gettext('skosmos:created') . ' ' . (Punic\Calendar::formatDate($created, 'short'));
455
+                $ret = gettext('skosmos:created').' '.(Punic\Calendar::formatDate($created, 'short'));
456 456
             }
457 457
 
458 458
             if ($modified != '') {
459 459
                 if ($created != '') {
460
-                    $ret .= ', ' . gettext('skosmos:modified') . ' ' . (Punic\Calendar::formatDate($modified, 'short'));
460
+                    $ret .= ', '.gettext('skosmos:modified').' '.(Punic\Calendar::formatDate($modified, 'short'));
461 461
                 } else {
462
-                    $ret .= ' ' . ucfirst(gettext('skosmos:modified')) . ' ' . (Punic\Calendar::formatDate($modified, 'short'));
462
+                    $ret .= ' '.ucfirst(gettext('skosmos:modified')).' '.(Punic\Calendar::formatDate($modified, 'short'));
463 463
                 }
464 464
 
465 465
             }
@@ -467,12 +467,12 @@  discard block
 block discarded – undo
467 467
             trigger_error($e->getMessage(), E_USER_WARNING);
468 468
             $ret = '';
469 469
             if ($this->resource->get('dc:modified')) {
470
-                $modified = (string) $this->resource->get('dc:modified');
471
-                $ret = gettext('skosmos:modified') . ' ' . $modified; 
470
+                $modified = (string)$this->resource->get('dc:modified');
471
+                $ret = gettext('skosmos:modified').' '.$modified; 
472 472
             }
473 473
             if ($this->resource->get('dc:created')) {
474
-                $created .= (string) $this->resource->get('dc:created');
475
-                $ret .= ' ' . gettext('skosmos:created') . ' ' . $created; 
474
+                $created .= (string)$this->resource->get('dc:created');
475
+                $ret .= ' '.gettext('skosmos:created').' '.$created; 
476 476
             }
477 477
         }
478 478
         return $ret;
@@ -580,13 +580,13 @@  discard block
 block discarded – undo
580 580
         $labels = array();
581 581
         foreach ($this->resource->allLiterals('skos:prefLabel') as $lit) {
582 582
             // filtering away subsets of the current language eg. en vs en-GB
583
-            if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang() . '-') !== 0) {
583
+            if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang().'-') !== 0) {
584 584
                 $labels[$this->literalLanguageToString($lit)][] = new ConceptPropertyValueLiteral($lit, 'skos:prefLabel');
585 585
             }
586 586
         }
587 587
         foreach ($this->resource->allLiterals('skos:altLabel') as $lit) {
588 588
             // filtering away subsets of the current language eg. en vs en-GB
589
-            if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang() . '-') !== 0) {
589
+            if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang().'-') !== 0) {
590 590
                 $labels[$this->literalLanguageToString($lit)][] = new ConceptPropertyValueLiteral($lit, 'skos:altLabel');
591 591
             }
592 592
         }
Please login to merge, or discard this patch.
controller/RestController.php 2 patches
Doc Comments   +26 added lines patch added patch discarded remove patch
@@ -114,6 +114,9 @@  discard block
 block discarded – undo
114 114
         return $this->returnJson($ret);
115 115
     }
116 116
     
117
+    /**
118
+     * @param Request $request
119
+     */
117 120
     private function constructSearchParameters($request)
118 121
     {
119 122
         $parameters = new ConceptSearchParameters($request, $this->model->getConfig(), true);
@@ -129,6 +132,9 @@  discard block
 block discarded – undo
129 132
         return $parameters;    
130 133
     }
131 134
 
135
+    /**
136
+     * @param Request $request
137
+     */
132 138
     private function transformSearchResults($request, $results)
133 139
     {
134 140
         // before serializing to JSON, get rid of the Vocabulary object that came with each resource
@@ -504,6 +510,9 @@  discard block
 block discarded – undo
504 510
         return $this->returnJson($ret);
505 511
     }
506 512
 
513
+    /**
514
+     * @param Request $request
515
+     */
507 516
     private function redirectToVocabData($request) {
508 517
         $urls = $request->getVocab()->getConfig()->getDataURLs();
509 518
         if (sizeof($urls) == 0) {
@@ -519,6 +528,9 @@  discard block
 block discarded – undo
519 528
         header("Location: " . $urls[$format]);
520 529
     }
521 530
     
531
+    /**
532
+     * @param string $format
533
+     */
522 534
     private function returnDataResults($results, $format) {
523 535
         if ($format == 'application/ld+json' || $format == 'application/json') {
524 536
             // further compact JSON-LD document using a context
@@ -606,6 +618,12 @@  discard block
 block discarded – undo
606 618
         return $this->returnJson($ret);
607 619
     }
608 620
     
621
+    /**
622
+     * @param string $uri
623
+     * @param string $lang
624
+     * @param string $propname
625
+     * @param string $propuri
626
+     */
609 627
     private function transformPropertyResults($uri, $lang, $objects, $propname, $propuri)
610 628
     {
611 629
         foreach ($objects as $objuri => $vals) {
@@ -620,6 +638,14 @@  discard block
 block discarded – undo
620 638
         return $ret;    
621 639
     }
622 640
     
641
+    /**
642
+     * @param string $uri
643
+     * @param string $lang
644
+     * @param string $tpropname
645
+     * @param string $tpropuri
646
+     * @param string $dpropname
647
+     * @param string $dpropuri
648
+     */
623 649
     private function transformTransitivePropertyResults($uri, $lang, $objects, $tpropname, $tpropuri, $dpropname, $dpropuri)
624 650
     {
625 651
         $results = array();
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         // wrap with JSONP callback if requested
26 26
         if (filter_input(INPUT_GET, 'callback', FILTER_SANITIZE_STRING)) {
27 27
             header("Content-type: application/javascript; charset=utf-8");
28
-            echo filter_input(INPUT_GET, 'callback', FILTER_UNSAFE_RAW) . "(" . json_encode($data) . ");";
28
+            echo filter_input(INPUT_GET, 'callback', FILTER_UNSAFE_RAW)."(".json_encode($data).");";
29 29
             return;
30 30
         }
31 31
         
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
                 'vocabularies' => 'onki:hasVocabulary',
89 89
                 'id' => 'onki:vocabularyIdentifier',
90 90
                 'uri' => '@id',
91
-                '@base' => $this->getBaseHref() . "rest/v1/vocabularies",
91
+                '@base' => $this->getBaseHref()."rest/v1/vocabularies",
92 92
             ),
93 93
             'uri' => '',
94 94
             'vocabularies' => $results,
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         // convert to vocids array to support multi-vocabulary search
106 106
         $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : array();
107 107
         $vocabObjects = array();
108
-        foreach($vocids as $vocid) {
108
+        foreach ($vocids as $vocid) {
109 109
             $vocabObjects[] = $this->model->getVocabulary($vocid);
110 110
         }
111 111
         $parameters->setVocabularies($vocabObjects);
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
         if ($request->getQueryParam('labellang')) {
145 145
             $ret['@context']['@language'] = $request->getQueryParam('labellang');
146 146
         } elseif ($request->getQueryParam('lang')) {
147
-            $ret['@context']['@language'] = $request->getQueryParam('lang');;
147
+            $ret['@context']['@language'] = $request->getQueryParam('lang'); ;
148 148
         }
149 149
         return $ret;
150 150
     }
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
                 'prefLabel' => 'skos:prefLabel',
212 212
                 'title' => 'dct:title',
213 213
                 '@language' => $request->getLang(),
214
-                '@base' => $this->getBaseHref() . "rest/v1/" . $vocab->getId() . "/",
214
+                '@base' => $this->getBaseHref()."rest/v1/".$vocab->getId()."/",
215 215
             ),
216 216
             'uri' => '',
217 217
             'id' => $vocab->getId(),
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
                 'subTypes' => array('@id' => 'void:class', '@type' => '@id'),
262 262
                 'count' => 'void:entities',
263 263
                 '@language' => $request->getLang(),
264
-                '@base' => $this->getBaseHref() . "rest/v1/" . $request->getVocab()->getId() . "/",
264
+                '@base' => $this->getBaseHref()."rest/v1/".$request->getVocab()->getId()."/",
265 265
             ),
266 266
             'uri' => '',
267 267
             'id' => $request->getVocab()->getId(),
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
                 'language' => 'void-ext:language',
336 336
                 'properties' => 'void:propertyPartition',
337 337
                 'labels' => 'void:triples',
338
-                '@base' => $this->getBaseHref() . "rest/v1/" . $request->getVocab()->getId() . "/",
338
+                '@base' => $this->getBaseHref()."rest/v1/".$request->getVocab()->getId()."/",
339 339
             ),
340 340
             'uri' => '',
341 341
             'id' => $request->getVocab()->getId(),
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
             $types[] = $type;
373 373
         }
374 374
 
375
-        $base = $request->getVocab() ? $this->getBaseHref() . "rest/v1/" . $request->getVocab()->getId() . "/" : $this->getBaseHref() . "rest/v1/";
375
+        $base = $request->getVocab() ? $this->getBaseHref()."rest/v1/".$request->getVocab()->getId()."/" : $this->getBaseHref()."rest/v1/";
376 376
 
377 377
         $ret = array_merge_recursive($this->context, array(
378 378
             '@context' => array(
@@ -530,10 +530,10 @@  discard block
 block discarded – undo
530 530
 
531 531
         $format = $this->negotiateFormat(array_keys($urls), $request->getServerConstant('HTTP_ACCEPT'), $request->getQueryParam('format'));
532 532
         if (!$format) {
533
-            return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: " . implode(' ', array_keys($urls)));
533
+            return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: ".implode(' ', array_keys($urls)));
534 534
         }
535 535
 
536
-        header("Location: " . $urls[$format]);
536
+        header("Location: ".$urls[$format]);
537 537
     }
538 538
     
539 539
     private function returnDataResults($results, $format) {
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 
588 588
         $format = $this->negotiateFormat(explode(' ', self::SUPPORTED_FORMATS), $request->getServerConstant('HTTP_ACCEPT'), $request->getQueryParam('format'));
589 589
         if (!$format) {
590
-            return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: " . self::SUPPORTED_FORMATS);
590
+            return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: ".self::SUPPORTED_FORMATS);
591 591
         }
592 592
 
593 593
         $vocid = $vocab ? $vocab->getId() : null;
Please login to merge, or discard this patch.
rest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     } elseif ($parts[1] == 'data') {
38 38
         $controller->data($request);
39 39
     } elseif (sizeof($parts) == 2) {
40
-        header("Location: " . $parts[1] . "/");
40
+        header("Location: ".$parts[1]."/");
41 41
     } else {
42 42
         $vocab = $parts[1];
43 43
         try {
@@ -93,5 +93,5 @@  discard block
 block discarded – undo
93 93
     }
94 94
 } catch (Exception $e) {
95 95
     header("HTTP/1.0 500 Internal Server Error");
96
-    echo('ERROR: ' . $e->getMessage());
96
+    echo('ERROR: '.$e->getMessage());
97 97
 }
Please login to merge, or discard this patch.
model/Request.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@
 block discarded – undo
106 106
 
107 107
     public function getRequestUri()
108 108
     {
109
-        return $this->getServerConstant('HTTP_HOST') . $this->getServerConstant('REQUEST_URI');
109
+        return $this->getServerConstant('HTTP_HOST').$this->getServerConstant('REQUEST_URI');
110 110
     }
111 111
     
112 112
     /**
Please login to merge, or discard this patch.
model/Model.php 1 patch
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.
model/VocabularyConfig.php 1 patch
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.