@@ -137,7 +137,8 @@ discard block  | 
                                                    ||
| 137 | 137 | |
| 138 | 138 | /**  | 
                                                        
| 139 | 139 | * @param array $langs Languages to query for  | 
                                                        
| 140 | - * @param array $props property names  | 
                                                        |
| 140 | + * @param string[] $props property names  | 
                                                        |
| 141 | + * @return string  | 
                                                        |
| 141 | 142 | */  | 
                                                        
| 142 | 143 |      private function generateCountLangConceptsQuery($langs, $classes, $props) { | 
                                                        
| 143 | 144 | $gc = $this->graphClause;  | 
                                                        
@@ -169,7 +170,7 @@ discard block  | 
                                                    ||
| 169 | 170 | * Transforms the CountLangConcepts results into an array of label counts.  | 
                                                        
| 170 | 171 | * @param EasyRdf_Sparql_Result $result query results to be transformed  | 
                                                        
| 171 | 172 | * @param array $langs Languages to query for  | 
                                                        
| 172 | - * @param array $props property names  | 
                                                        |
| 173 | + * @param string[] $props property names  | 
                                                        |
| 173 | 174 | */  | 
                                                        
| 174 | 175 |      private function transformCountLangConceptsResults($result, $langs, $props) { | 
                                                        
| 175 | 176 | $ret = array();  | 
                                                        
@@ -56,12 +56,16 @@ discard block  | 
                                                    ||
| 56 | 56 | $this->model = $model;  | 
                                                        
| 57 | 57 | |
| 58 | 58 | // set graphClause so that it can be used by all queries  | 
                                                        
| 59 | - if ($this->isDefaultEndpoint()) // default endpoint; query any graph (and catch it in a variable)  | 
                                                        |
| 59 | +        if ($this->isDefaultEndpoint()) { | 
                                                        |
| 60 | + // default endpoint; query any graph (and catch it in a variable)  | 
                                                        |
| 60 | 61 |          { | 
                                                        
| 61 | 62 | $this->graphClause = "GRAPH $graph";  | 
                                                        
| 62 | - } elseif ($graph) // query a specific graph  | 
                                                        |
| 63 | + }  | 
                                                        |
| 64 | +        } elseif ($graph) { | 
                                                        |
| 65 | + // query a specific graph  | 
                                                        |
| 63 | 66 |          { | 
                                                        
| 64 | 67 | $this->graphClause = "GRAPH <$graph>";  | 
                                                        
| 68 | + }  | 
                                                        |
| 65 | 69 | } else // query the default graph  | 
                                                        
| 66 | 70 |          { | 
                                                        
| 67 | 71 | $this->graphClause = "";  | 
                                                        
@@ -616,9 +620,11 @@ discard block  | 
                                                    ||
| 616 | 620 | // extra types to query, if using thesaurus arrays and no additional type restrictions have been applied  | 
                                                        
| 617 | 621 |          $extratypes = ($arrayClass && $types === array('skos:Concept')) ? "UNION { ?s a <$arrayClass> }" : ""; | 
                                                        
| 618 | 622 | |
| 619 | - if (sizeof($unprefixed_types) === 1) // if only one type limitation set no UNION needed  | 
                                                        |
| 623 | +        if (sizeof($unprefixed_types) === 1) { | 
                                                        |
| 624 | + // if only one type limitation set no UNION needed  | 
                                                        |
| 620 | 625 |          { | 
                                                        
| 621 | 626 | $type = '<' . $unprefixed_types[0] . '>';  | 
                                                        
| 627 | + }  | 
                                                        |
| 622 | 628 |          } else { // multiple type limitations require setting a UNION for each of those | 
                                                        
| 623 | 629 | $type = '[]';  | 
                                                        
| 624 | 630 |              foreach ($unprefixed_types as $utype) { | 
                                                        
@@ -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) use ($controller) { | 
                                                        |
| 117 | +        $langFilter = new Twig_SimpleFilter('lang_name', function($langcode, $lang) use ($controller) { | 
                                                        |
| 118 | 118 | return Language::getName($langcode, $lang);  | 
                                                        
| 119 | 119 | });  | 
                                                        
| 120 | 120 | $this->twig->addFilter($langFilter);  | 
                                                        
@@ -611,7 +611,7 @@ discard block  | 
                                                    ||
| 611 | 611 | * Loads and renders the view containing a list of recent changes in the vocabulary.  | 
                                                        
| 612 | 612 | * @param Request $request  | 
                                                        
| 613 | 613 | */  | 
                                                        
| 614 | - public function invokeChangeList($request, $prop='dc:created')  | 
                                                        |
| 614 | + public function invokeChangeList($request, $prop = 'dc:created')  | 
                                                        |
| 615 | 615 |      { | 
                                                        
| 616 | 616 | // set language parameters for gettext  | 
                                                        
| 617 | 617 | $this->setLanguageProperties($request->getLang());  | 
                                                        
@@ -1,9 +1,9 @@  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | 2 | /**  | 
                                                        
| 3 | - * Copyright (c) 2012-2013 Aalto University and University of Helsinki  | 
                                                        |
| 4 | - * MIT License  | 
                                                        |
| 5 | - * see LICENSE.txt for more information  | 
                                                        |
| 6 | - */  | 
                                                        |
| 3 | + * Copyright (c) 2012-2013 Aalto University and University of Helsinki  | 
                                                        |
| 4 | + * MIT License  | 
                                                        |
| 5 | + * see LICENSE.txt for more information  | 
                                                        |
| 6 | + */  | 
                                                        |
| 7 | 7 | |
| 8 | 8 | /* Register text: namespace needed for jena-text queries */  | 
                                                        
| 9 | 9 |  EasyRdf_Namespace::set('text', 'http://jena.apache.org/text#'); | 
                                                        
@@ -381,10 +381,12 @@  | 
                                                    ||
| 381 | 381 | // register vocabulary ids as RDF namespace prefixes  | 
                                                        
| 382 | 382 |                  $prefix = preg_replace('/\W+/', '', $voc->getId()); // strip non-word characters | 
                                                        
| 383 | 383 |                  try { | 
                                                        
| 384 | - if ($prefix != '' && EasyRdf_Namespace::get($prefix) === null) // if not already defined  | 
                                                        |
| 384 | +                    if ($prefix != '' && EasyRdf_Namespace::get($prefix) === null) { | 
                                                        |
| 385 | + // if not already defined  | 
                                                        |
| 385 | 386 |                      { | 
                                                        
| 386 | 387 | EasyRdf_Namespace::set($prefix, $voc->getUriSpace());  | 
                                                        
| 387 | 388 | }  | 
                                                        
| 389 | + }  | 
                                                        |
| 388 | 390 | |
| 389 | 391 |                  } catch (Exception $e) { | 
                                                        
| 390 | 392 | // not valid as namespace identifier, ignore  | 
                                                        
@@ -1,9 +1,9 @@  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | 2 | /**  | 
                                                        
| 3 | - * Copyright (c) 2012 Aalto University and University of Helsinki  | 
                                                        |
| 4 | - * MIT License  | 
                                                        |
| 5 | - * see LICENSE.txt for more information  | 
                                                        |
| 6 | - */  | 
                                                        |
| 3 | + * Copyright (c) 2012 Aalto University and University of Helsinki  | 
                                                        |
| 4 | + * MIT License  | 
                                                        |
| 5 | + * see LICENSE.txt for more information  | 
                                                        |
| 6 | + */  | 
                                                        |
| 7 | 7 | |
| 8 | 8 | /**  | 
                                                        
| 9 | 9 | * Includes the side wide settings.  | 
                                                        
@@ -33,7 +33,7 @@ discard block  | 
                                                    ||
| 33 | 33 | * @param string $property the property to query  | 
                                                        
| 34 | 34 | * @param string $lang preferred language for the literal,  | 
                                                        
| 35 | 35 | */  | 
                                                        
| 36 | - private function getLiteral($property, $lang=null)  | 
                                                        |
| 36 | + private function getLiteral($property, $lang = null)  | 
                                                        |
| 37 | 37 |      { | 
                                                        
| 38 | 38 |          if (!isset($lang)) {; | 
                                                        
| 39 | 39 | $lang = $this->getEnvLang();  | 
                                                        
@@ -909,9 +909,9 @@ discard block  | 
                                                    ||
| 909 | 909 |      { | 
                                                        
| 910 | 910 | $changelist = $this->getSparql()->queryChangeList($clang, $offset, $prop);  | 
                                                        
| 911 | 911 | $bydate = array();  | 
                                                        
| 912 | -      foreach($changelist as $concept) { | 
                                                        |
| 912 | +      foreach ($changelist as $concept) { | 
                                                        |
| 913 | 913 | $concept['datestring'] = Punic\Calendar::formatDate($concept['date'], 'medium', $lang);  | 
                                                        
| 914 | - $bydate[Punic\Calendar::getMonthName($concept['date'], 'wide', $lang, true) . Punic\Calendar::format($concept['date'], ' y', $lang) ][strtolower($concept['prefLabel'])] = $concept;  | 
                                                        |
| 914 | + $bydate[Punic\Calendar::getMonthName($concept['date'], 'wide', $lang, true) . Punic\Calendar::format($concept['date'], ' y', $lang)][strtolower($concept['prefLabel'])] = $concept;  | 
                                                        |
| 915 | 915 | }  | 
                                                        
| 916 | 916 | return $bydate;  | 
                                                        
| 917 | 917 | }  | 
                                                        
@@ -46,8 +46,9 @@ discard block  | 
                                                    ||
| 46 | 46 | |
| 47 | 47 | // not found with selected language, try any language  | 
                                                        
| 48 | 48 | $literal = $this->resource->getLiteral($property);  | 
                                                        
| 49 | - if ($literal)  | 
                                                        |
| 50 | - return $literal->getValue();  | 
                                                        |
| 49 | +        if ($literal) { | 
                                                        |
| 50 | + return $literal->getValue();  | 
                                                        |
| 51 | + }  | 
                                                        |
| 51 | 52 | }  | 
                                                        
| 52 | 53 | |
| 53 | 54 | /**  | 
                                                        
@@ -57,11 +58,12 @@ discard block  | 
                                                    ||
| 57 | 58 | public function getId()  | 
                                                        
| 58 | 59 |      { | 
                                                        
| 59 | 60 |          $uriparts = explode("#", $this->resource->getURI()); | 
                                                        
| 60 | - if (count($uriparts) != 1)  | 
                                                        |
| 61 | - // hash namespace  | 
                                                        |
| 61 | +        if (count($uriparts) != 1) { | 
                                                        |
| 62 | + // hash namespace  | 
                                                        |
| 62 | 63 |          { | 
                                                        
| 63 | 64 | return $uriparts[1];  | 
                                                        
| 64 | 65 | }  | 
                                                        
| 66 | + }  | 
                                                        |
| 65 | 67 | |
| 66 | 68 | // slash namespace  | 
                                                        
| 67 | 69 |          $uriparts = explode("/", $this->resource->getURI()); | 
                                                        
@@ -180,10 +182,12 @@ discard block  | 
                                                    ||
| 180 | 182 | */  | 
                                                        
| 181 | 183 | public function getUriSpace()  | 
                                                        
| 182 | 184 |      { | 
                                                        
| 183 | - if ($this->urispace === null) // initialize cache  | 
                                                        |
| 185 | +        if ($this->urispace === null) { | 
                                                        |
| 186 | + // initialize cache  | 
                                                        |
| 184 | 187 |          { | 
                                                        
| 185 | 188 |              $this->urispace = $this->resource->getLiteral('void:uriSpace')->getValue(); | 
                                                        
| 186 | 189 | }  | 
                                                        
| 190 | + }  | 
                                                        |
| 187 | 191 | |
| 188 | 192 | return $this->urispace;  | 
                                                        
| 189 | 193 | }  | 
                                                        
@@ -243,8 +247,9 @@ discard block  | 
                                                    ||
| 243 | 247 | public function getShortName()  | 
                                                        
| 244 | 248 |      { | 
                                                        
| 245 | 249 |          $shortname = $this->getLiteral('skosmos:shortName'); | 
                                                        
| 246 | - if ($shortname)  | 
                                                        |
| 247 | - return $shortname;  | 
                                                        |
| 250 | +        if ($shortname) { | 
                                                        |
| 251 | + return $shortname;  | 
                                                        |
| 252 | + }  | 
                                                        |
| 248 | 253 | |
| 249 | 254 | // if no shortname exists fall back to the id  | 
                                                        
| 250 | 255 | return $this->getId();  | 
                                                        
@@ -513,10 +518,12 @@ discard block  | 
                                                    ||
| 513 | 518 | $ret = array();  | 
                                                        
| 514 | 519 |          foreach ($resources as $res) { | 
                                                        
| 515 | 520 | $prop = $res->getURI();  | 
                                                        
| 516 | - if (EasyRdf_Namespace::shorten($prop) !== null) // shortening property labels if possible  | 
                                                        |
| 521 | +            if (EasyRdf_Namespace::shorten($prop) !== null) { | 
                                                        |
| 522 | + // shortening property labels if possible  | 
                                                        |
| 517 | 523 |              { | 
                                                        
| 518 | 524 | $prop = EasyRdf_Namespace::shorten($prop);  | 
                                                        
| 519 | 525 | }  | 
                                                        
| 526 | + }  | 
                                                        |
| 520 | 527 | |
| 521 | 528 | $ret[] = $prop;  | 
                                                        
| 522 | 529 | }  | 
                                                        
@@ -533,10 +540,12 @@ discard block  | 
                                                    ||
| 533 | 540 |          $resources = $this->resource->allResources("skosmos:hasMultiLingualProperty"); | 
                                                        
| 534 | 541 |          foreach ($resources as $res) { | 
                                                        
| 535 | 542 | $prop = $res->getURI();  | 
                                                        
| 536 | - if (EasyRdf_Namespace::shorten($prop) !== null) // shortening property labels if possible  | 
                                                        |
| 543 | +            if (EasyRdf_Namespace::shorten($prop) !== null) { | 
                                                        |
| 544 | + // shortening property labels if possible  | 
                                                        |
| 537 | 545 |              { | 
                                                        
| 538 | 546 | $prop = EasyRdf_Namespace::shorten($prop);  | 
                                                        
| 539 | 547 | }  | 
                                                        
| 548 | + }  | 
                                                        |
| 540 | 549 | |
| 541 | 550 |              if ($prop === $property) { | 
                                                        
| 542 | 551 | return true;  | 
                                                        
@@ -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 | }  | 
                                                        
@@ -461,7 +461,7 @@  | 
                                                    ||
| 461 | 461 | }  | 
                                                        
| 462 | 462 |          } catch (Exception $e) { | 
                                                        
| 463 | 463 | trigger_error($e->getMessage(), E_USER_WARNING);  | 
                                                        
| 464 | -            return gettext('skosmos:modified') . ' ' . (string) $this->resource->get('dc:modified') . ' ' . gettext('skosmos:created') . ' ' . (string) $this->resource->get('dc:created'); | 
                                                        |
| 464 | +            return gettext('skosmos:modified') . ' ' . (string)$this->resource->get('dc:modified') . ' ' . gettext('skosmos:created') . ' ' . (string)$this->resource->get('dc:created'); | 
                                                        |
| 465 | 465 | }  | 
                                                        
| 466 | 466 | return $ret;  | 
                                                        
| 467 | 467 | }  | 
                                                        
@@ -1,9 +1,9 @@  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | 2 | /**  | 
                                                        
| 3 | - * Copyright (c) 2012-2013 Aalto University and University of Helsinki  | 
                                                        |
| 4 | - * MIT License  | 
                                                        |
| 5 | - * see LICENSE.txt for more information  | 
                                                        |
| 6 | - */  | 
                                                        |
| 3 | + * Copyright (c) 2012-2013 Aalto University and University of Helsinki  | 
                                                        |
| 4 | + * MIT License  | 
                                                        |
| 5 | + * see LICENSE.txt for more information  | 
                                                        |
| 6 | + */  | 
                                                        |
| 7 | 7 | |
| 8 | 8 | /* Register text: namespace needed for jena-text queries */  | 
                                                        
| 9 | 9 |  EasyRdf_Namespace::set('text', 'http://jena.apache.org/text#'); | 
                                                        
@@ -1,9 +1,9 @@  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | 2 | /**  | 
                                                        
| 3 | - * Copyright (c) 2012-2013 Aalto University and University of Helsinki  | 
                                                        |
| 4 | - * MIT License  | 
                                                        |
| 5 | - * see LICENSE.txt for more information  | 
                                                        |
| 6 | - */  | 
                                                        |
| 3 | + * Copyright (c) 2012-2013 Aalto University and University of Helsinki  | 
                                                        |
| 4 | + * MIT License  | 
                                                        |
| 5 | + * see LICENSE.txt for more information  | 
                                                        |
| 6 | + */  | 
                                                        |
| 7 | 7 | |
| 8 | 8 | /* Register text: namespace needed for jena-text queries */  | 
                                                        
| 9 | 9 |  EasyRdf_Namespace::set('text', 'http://jena.apache.org/text#'); | 
                                                        
@@ -37,7 +37,7 @@  | 
                                                    ||
| 37 | 37 | * @return string SPARQL text search clause  | 
                                                        
| 38 | 38 | */  | 
                                                        
| 39 | 39 | |
| 40 | - protected function createTextQueryCondition($term, $property='')  | 
                                                        |
| 40 | + protected function createTextQueryCondition($term, $property = '')  | 
                                                        |
| 41 | 41 |    { | 
                                                        
| 42 | 42 | // construct the lucene search term for jena-text  | 
                                                        
| 43 | 43 | |
@@ -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();  | 
                                                        
@@ -118,7 +118,7 @@  | 
                                                    ||
| 118 | 118 | */  | 
                                                        
| 119 | 119 | public function getEnvLang()  | 
                                                        
| 120 | 120 |      { | 
                                                        
| 121 | - // get language from locale, same as used by gettext, set by Controller  | 
                                                        |
| 122 | -       return substr(getenv("LC_ALL"), 0, 2); | 
                                                        |
| 121 | + // get language from locale, same as used by gettext, set by Controller  | 
                                                        |
| 122 | +        return substr(getenv("LC_ALL"), 0, 2); | 
                                                        |
| 123 | 123 | }  | 
                                                        
| 124 | 124 | }  | 
                                                        
@@ -72,10 +72,12 @@  | 
                                                    ||
| 72 | 72 | |
| 73 | 73 | uksort($sortable, array($this, 'mycompare'));  | 
                                                        
| 74 | 74 |          foreach ($sortable as $prop => $vals) { | 
                                                        
| 75 | - if (is_array($prop)) // the ConceptProperty objects have their own sorting methods  | 
                                                        |
| 75 | +            if (is_array($prop)) { | 
                                                        |
| 76 | + // the ConceptProperty objects have their own sorting methods  | 
                                                        |
| 76 | 77 |              { | 
                                                        
| 77 | 78 | ksort($sortable[$prop]);  | 
                                                        
| 78 | 79 | }  | 
                                                        
| 80 | + }  | 
                                                        |
| 79 | 81 | |
| 80 | 82 | }  | 
                                                        
| 81 | 83 | |