@@ -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(); |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | * Counts the statistics of the vocabulary. |
| 279 | 279 | * @return array of the concept/group counts |
| 280 | 280 | */ |
| 281 | - public function getStatistics($lang = '', $array=null, $group=null) |
|
| 281 | + public function getStatistics($lang = '', $array = null, $group = null) |
|
| 282 | 282 | { |
| 283 | 283 | $sparql = $this->getSparql(); |
| 284 | 284 | // find the number of concepts |
@@ -594,14 +594,14 @@ discard block |
||
| 594 | 594 | { |
| 595 | 595 | $changelist = $this->getSparql()->queryChangeList($clang, $offset, $prop); |
| 596 | 596 | $bydate = array(); |
| 597 | - foreach($changelist as $concept) { |
|
| 597 | + foreach ($changelist as $concept) { |
|
| 598 | 598 | $concept['datestring'] = Punic\Calendar::formatDate($concept['date'], 'medium', $lang); |
| 599 | - $bydate[Punic\Calendar::getMonthName($concept['date'], 'wide', $lang, true) . Punic\Calendar::format($concept['date'], ' y', $lang) ][strtolower($concept['prefLabel'])] = $concept; |
|
| 599 | + $bydate[Punic\Calendar::getMonthName($concept['date'], 'wide', $lang, true) . Punic\Calendar::format($concept['date'], ' y', $lang)][strtolower($concept['prefLabel'])] = $concept; |
|
| 600 | 600 | } |
| 601 | 601 | return $bydate; |
| 602 | 602 | } |
| 603 | 603 | |
| 604 | - public function getTitle($lang=null) { |
|
| 604 | + public function getTitle($lang = null) { |
|
| 605 | 605 | return $this->config->getTitle($lang); |
| 606 | 606 | } |
| 607 | 607 | |
@@ -585,7 +585,7 @@ |
||
| 585 | 585 | |
| 586 | 586 | /** |
| 587 | 587 | * Generate a VALUES clause for limiting the targeted graphs. |
| 588 | - * @param array $vocabs array of Vocabulary objects to target |
|
| 588 | + * @param Vocabulary[] $vocabs array of Vocabulary objects to target |
|
| 589 | 589 | * @return string VALUES clause, or "" if not necessary to limit |
| 590 | 590 | */ |
| 591 | 591 | protected function formatValuesGraph($vocabs) { |
@@ -651,7 +651,7 @@ discard block |
||
| 651 | 651 | } |
| 652 | 652 | } |
| 653 | 653 | |
| 654 | - return implode(' UNION ', $type_patterns);; |
|
| 654 | + return implode(' UNION ', $type_patterns); ; |
|
| 655 | 655 | } |
| 656 | 656 | |
| 657 | 657 | /** |
@@ -829,7 +829,7 @@ discard block |
||
| 829 | 829 | |
| 830 | 830 | $schemecond = ''; |
| 831 | 831 | if (!empty($schemes)) { |
| 832 | - foreach($schemes as $scheme) { |
|
| 832 | + foreach ($schemes as $scheme) { |
|
| 833 | 833 | $schemecond .= "?s skos:inScheme <$scheme> . "; |
| 834 | 834 | } |
| 835 | 835 | } |
@@ -918,7 +918,7 @@ discard block |
||
| 918 | 918 | $hit['type'][] = $qnamecache[$typeuri]; |
| 919 | 919 | } |
| 920 | 920 | |
| 921 | - if(!empty($fields)) { |
|
| 921 | + if (!empty($fields)) { |
|
| 922 | 922 | foreach ($fields as $prop) { |
| 923 | 923 | $propname = $prop . 's'; |
| 924 | 924 | if (isset($row->$propname)) { |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | // register a Twig filter for generating URLs for vocabulary resources (concepts and groups) |
| 75 | 75 | $controller = $this; // for use by anonymous function below |
| 76 | - $urlFilter = new Twig_SimpleFilter('link_url', function ($uri, $vocab, $lang, $type = 'page', $clang = null, $term = null) use ($controller) { |
|
| 76 | + $urlFilter = new Twig_SimpleFilter('link_url', function($uri, $vocab, $lang, $type = 'page', $clang = null, $term = null) use ($controller) { |
|
| 77 | 77 | // $vocab can either be null, a vocabulary id (string) or a Vocabulary object |
| 78 | 78 | if ($vocab === null) { |
| 79 | 79 | // target vocabulary is unknown, best bet is to link to the plain URI |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | $this->twig->addFilter($urlFilter); |
| 115 | 115 | |
| 116 | 116 | // register a Twig filter for generating strings from language codes with CLDR |
| 117 | - $langFilter = new Twig_SimpleFilter('lang_name', function ($langcode, $lang) { |
|
| 117 | + $langFilter = new Twig_SimpleFilter('lang_name', function($langcode, $lang) { |
|
| 118 | 118 | return Language::getName($langcode, $lang); |
| 119 | 119 | }); |
| 120 | 120 | $this->twig->addFilter($langFilter); |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : null; |
| 359 | 359 | $vocabObjects = array(); |
| 360 | 360 | if ($vocids) { |
| 361 | - foreach($vocids as $vocid) { |
|
| 361 | + foreach ($vocids as $vocid) { |
|
| 362 | 362 | $vocabObjects[] = $this->model->getVocabulary($vocid); |
| 363 | 363 | } |
| 364 | 364 | } |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | 'search_count' => $counts, |
| 386 | 386 | 'languages' => $this->languages, |
| 387 | 387 | 'search_results' => $search_results, |
| 388 | - 'rest' => $parameters->getOffset()>0, |
|
| 388 | + 'rest' => $parameters->getOffset() > 0, |
|
| 389 | 389 | 'global_search' => true, |
| 390 | 390 | 'term' => $request->getQueryParam('q'), |
| 391 | 391 | 'lang_list' => $langList, |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | 'vocab' => $vocab, |
| 449 | 449 | 'search_results' => $search_results, |
| 450 | 450 | 'search_count' => $counts, |
| 451 | - 'rest' => $parameters->getOffset()>0, |
|
| 451 | + 'rest' => $parameters->getOffset() > 0, |
|
| 452 | 452 | 'limit_parent' => $parameters->getParentLimit(), |
| 453 | 453 | 'limit_type' => $request->getQueryParam('type'), |
| 454 | 454 | 'limit_group' => $parameters->getGroupLimit(), |
@@ -594,7 +594,7 @@ discard block |
||
| 594 | 594 | * Loads and renders the view containing a list of recent changes in the vocabulary. |
| 595 | 595 | * @param Request $request |
| 596 | 596 | */ |
| 597 | - public function invokeChangeList($request, $prop='dc:created') |
|
| 597 | + public function invokeChangeList($request, $prop = 'dc:created') |
|
| 598 | 598 | { |
| 599 | 599 | // set language parameters for gettext |
| 600 | 600 | $this->setLanguageProperties($request->getLang()); |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | // convert to vocids array to support multi-vocabulary search |
| 169 | 169 | $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : array(); |
| 170 | 170 | $vocabObjects = array(); |
| 171 | - foreach($vocids as $vocid) { |
|
| 171 | + foreach ($vocids as $vocid) { |
|
| 172 | 172 | $vocabObjects[] = $this->model->getVocabulary($vocid); |
| 173 | 173 | } |
| 174 | 174 | $parameters->setVocabularies($vocabObjects); |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | if ($request->getQueryParam('labellang')) { |
| 202 | 202 | $ret['@context']['@language'] = $request->getQueryParam('labellang'); |
| 203 | 203 | } elseif ($request->getQueryParam('lang')) { |
| 204 | - $ret['@context']['@language'] = $request->getQueryParam('lang');; |
|
| 204 | + $ret['@context']['@language'] = $request->getQueryParam('lang'); ; |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | return $this->returnJson($ret); |
@@ -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)) { |
@@ -382,7 +382,7 @@ |
||
| 382 | 382 | public function getVocabularyCategories() |
| 383 | 383 | { |
| 384 | 384 | $cats = $this->graph->allOfType('skos:Concept'); |
| 385 | - if(empty($cats)) { |
|
| 385 | + if (empty($cats)) { |
|
| 386 | 386 | return array(new VocabularyCategory($this, null)); |
| 387 | 387 | } |
| 388 | 388 | |
@@ -6,7 +6,7 @@ |
||
| 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 | 12 | $file_path = dirname(__FILE__) . $config_name; |
@@ -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)) { |
@@ -118,7 +118,7 @@ |
||
| 118 | 118 | return $type; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - private function getQueryParam($name, $explode=false) { |
|
| 121 | + private function getQueryParam($name, $explode = false) { |
|
| 122 | 122 | if ($explode) { |
| 123 | 123 | return $this->request->getQueryParam($name) ? explode(' ', $this->request->getQueryParam($name)) : null; |
| 124 | 124 | } |