@@ -167,9 +167,11 @@ |
||
167 | 167 | */ |
168 | 168 | public function setVocab($vocabid) |
169 | 169 | { |
170 | - if (strpos($vocabid, ' ') !== false) // if there are multiple vocabularies just storing the string |
|
170 | + if (strpos($vocabid, ' ') !== false) { |
|
171 | + // if there are multiple vocabularies just storing the string |
|
171 | 172 | { |
172 | 173 | $this->setVocabids($vocabid); |
174 | + } |
|
173 | 175 | } else { |
174 | 176 | $this->vocab = $this->model->getVocabulary($vocabid); |
175 | 177 | } |
@@ -106,7 +106,7 @@ |
||
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 | /** |
@@ -44,7 +44,7 @@ |
||
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(); |
@@ -76,10 +76,12 @@ |
||
76 | 76 | */ |
77 | 77 | public function getUriSpace() |
78 | 78 | { |
79 | - if ($this->urispace === null) // initialize cache |
|
79 | + if ($this->urispace === null) { |
|
80 | + // initialize cache |
|
80 | 81 | { |
81 | 82 | $this->urispace = $this->resource->getLiteral('void:uriSpace')->getValue(); |
82 | 83 | } |
84 | + } |
|
83 | 85 | |
84 | 86 | return $this->urispace; |
85 | 87 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | return $lname; |
93 | 93 | } |
94 | 94 | // already a full URI |
95 | - return $this->getUriSpace() . $lname; |
|
95 | + return $this->getUriSpace().$lname; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | foreach ($conceptscheme->allLiterals($prop, null) as $val) { |
154 | 154 | $prop = (substr($prop, 0, 5) == 'dc11:') ? str_replace('dc11:', 'dc:', $prop) : $prop; |
155 | 155 | if ($val->getValue() instanceof DateTime) { |
156 | - $val = Punic\Calendar::formatDate($val->getValue(), 'full', $lang) . ' ' . Punic\Calendar::format($val->getValue(), 'HH:mm:ss', $lang); |
|
156 | + $val = Punic\Calendar::formatDate($val->getValue(), 'full', $lang).' '.Punic\Calendar::format($val->getValue(), 'HH:mm:ss', $lang); |
|
157 | 157 | } |
158 | 158 | $ret[$prop][] = $val; |
159 | 159 | } |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | } |
265 | 265 | // don't know how to parse |
266 | 266 | $rev = $parts[2]; |
267 | - $datestr = $parts[3] . ' ' . $parts[4]; |
|
267 | + $datestr = $parts[3].' '.$parts[4]; |
|
268 | 268 | |
269 | 269 | return "$datestr (r$rev)"; |
270 | 270 | } |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * Counts the statistics of the vocabulary. |
274 | 274 | * @return array of the concept/group counts |
275 | 275 | */ |
276 | - public function getStatistics($lang = '', $array=null, $group=null) |
|
276 | + public function getStatistics($lang = '', $array = null, $group = null) |
|
277 | 277 | { |
278 | 278 | $sparql = $this->getSparql(); |
279 | 279 | // find the number of concepts |
@@ -591,14 +591,14 @@ discard block |
||
591 | 591 | { |
592 | 592 | $changelist = $this->getSparql()->queryChangeList($clang, $offset, $prop); |
593 | 593 | $bydate = array(); |
594 | - foreach($changelist as $concept) { |
|
594 | + foreach ($changelist as $concept) { |
|
595 | 595 | $concept['datestring'] = Punic\Calendar::formatDate($concept['date'], 'medium', $lang); |
596 | - $bydate[Punic\Calendar::getMonthName($concept['date'], 'wide', $lang, true) . Punic\Calendar::format($concept['date'], ' y', $lang) ][strtolower($concept['prefLabel'])] = $concept; |
|
596 | + $bydate[Punic\Calendar::getMonthName($concept['date'], 'wide', $lang, true).Punic\Calendar::format($concept['date'], ' y', $lang)][strtolower($concept['prefLabel'])] = $concept; |
|
597 | 597 | } |
598 | 598 | return $bydate; |
599 | 599 | } |
600 | 600 | |
601 | - public function getTitle($lang=null) { |
|
601 | + public function getTitle($lang = null) { |
|
602 | 602 | return $this->config->getTitle($lang); |
603 | 603 | } |
604 | 604 |
@@ -10,6 +10,9 @@ |
||
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)) { |
@@ -23,6 +23,9 @@ |
||
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)) { |
@@ -6,10 +6,10 @@ discard block |
||
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 |
||
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 | } |
@@ -68,10 +68,12 @@ |
||
68 | 68 | if ($sortable !== null) { |
69 | 69 | uksort($sortable, array($this, 'mycompare')); |
70 | 70 | foreach ($sortable as $prop => $vals) { |
71 | - if (is_array($prop)) // the ConceptProperty objects have their own sorting methods |
|
71 | + if (is_array($prop)) { |
|
72 | + // the ConceptProperty objects have their own sorting methods |
|
72 | 73 | { |
73 | 74 | ksort($sortable[$prop]); |
74 | 75 | } |
76 | + } |
|
75 | 77 | |
76 | 78 | } |
77 | 79 | } |
@@ -114,7 +114,7 @@ |
||
114 | 114 | */ |
115 | 115 | public function getEnvLang() |
116 | 116 | { |
117 | - // get language from locale, same as used by gettext, set by Controller |
|
118 | - return substr(getenv("LC_ALL"), 0, 2); // @codeCoverageIgnore |
|
117 | + // get language from locale, same as used by gettext, set by Controller |
|
118 | + return substr(getenv("LC_ALL"), 0, 2); // @codeCoverageIgnore |
|
119 | 119 | } |
120 | 120 | } |
@@ -55,6 +55,7 @@ discard block |
||
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 |
||
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(); |
@@ -121,9 +121,9 @@ discard block |
||
121 | 121 | |
122 | 122 | // 3. label in a subtag of the current language |
123 | 123 | // We need to check all the labels in case one of them matches a subtag of the current language |
124 | - foreach($this->resource->allLiterals('skos:prefLabel') as $label) { |
|
124 | + foreach ($this->resource->allLiterals('skos:prefLabel') as $label) { |
|
125 | 125 | // the label lang code is a subtag of the UI lang eg. en-GB - create a new literal with the main language |
126 | - if ($label !== null && strpos($label->getLang(), $lang . '-') === 0) { |
|
126 | + if ($label !== null && strpos($label->getLang(), $lang.'-') === 0) { |
|
127 | 127 | return EasyRdf_Literal::create($label, $lang); |
128 | 128 | } |
129 | 129 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | // 4. label in any language, including literal with empty language tag |
132 | 132 | $label = $this->resource->label(); |
133 | 133 | if ($label !== null) { |
134 | - return $label->getLang() ? $label->getValue() . " (" . $label->getLang() . ")" : $label->getValue(); |
|
134 | + return $label->getLang() ? $label->getValue()." (".$label->getLang().")" : $label->getValue(); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | // empty |
@@ -462,14 +462,14 @@ discard block |
||
462 | 462 | |
463 | 463 | // making a human readable string from the timestamps |
464 | 464 | if ($created != '') { |
465 | - $ret = gettext('skosmos:created') . ' ' . (Punic\Calendar::formatDate($created, 'short')); |
|
465 | + $ret = gettext('skosmos:created').' '.(Punic\Calendar::formatDate($created, 'short')); |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | if ($modified != '') { |
469 | 469 | if ($created != '') { |
470 | - $ret .= ', ' . gettext('skosmos:modified') . ' ' . (Punic\Calendar::formatDate($modified, 'short')); |
|
470 | + $ret .= ', '.gettext('skosmos:modified').' '.(Punic\Calendar::formatDate($modified, 'short')); |
|
471 | 471 | } else { |
472 | - $ret .= ' ' . ucfirst(gettext('skosmos:modified')) . ' ' . (Punic\Calendar::formatDate($modified, 'short')); |
|
472 | + $ret .= ' '.ucfirst(gettext('skosmos:modified')).' '.(Punic\Calendar::formatDate($modified, 'short')); |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | } |
@@ -477,12 +477,12 @@ discard block |
||
477 | 477 | trigger_error($e->getMessage(), E_USER_WARNING); |
478 | 478 | $ret = ''; |
479 | 479 | if ($this->resource->get('dc:modified')) { |
480 | - $modified = (string) $this->resource->get('dc:modified'); |
|
481 | - $ret = gettext('skosmos:modified') . ' ' . $modified; |
|
480 | + $modified = (string)$this->resource->get('dc:modified'); |
|
481 | + $ret = gettext('skosmos:modified').' '.$modified; |
|
482 | 482 | } |
483 | 483 | if ($this->resource->get('dc:created')) { |
484 | - $created .= (string) $this->resource->get('dc:created'); |
|
485 | - $ret .= ' ' . gettext('skosmos:created') . ' ' . $created; |
|
484 | + $created .= (string)$this->resource->get('dc:created'); |
|
485 | + $ret .= ' '.gettext('skosmos:created').' '.$created; |
|
486 | 486 | } |
487 | 487 | } |
488 | 488 | return $ret; |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | $ret = array(); |
593 | 593 | foreach ($labels as $lit) { |
594 | 594 | // filtering away subsets of the current language eg. en vs en-GB |
595 | - if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang() . '-') !== 0) { |
|
595 | + if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang().'-') !== 0) { |
|
596 | 596 | $prop = in_array($lit, $prefLabels) ? 'skos:prefLabel' : 'skos:altLabel'; |
597 | 597 | $ret[$this->literalLanguageToString($lit)][] = new ConceptPropertyValueLiteral($lit, $prop); |
598 | 598 | } |
@@ -37,7 +37,7 @@ discard block |
||
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 |
||
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 | } |
@@ -7,7 +7,7 @@ discard block |
||
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 |
||
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 |
||
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; |
@@ -53,8 +53,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |