@@ -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 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | return $lname; |
| 98 | 98 | } |
| 99 | 99 | // already a full URI |
| 100 | - return $this->getUriSpace() . $lname; |
|
| 100 | + return $this->getUriSpace().$lname; |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | $prop = (substr($prop, 0, 5) == 'dc11:') ? str_replace('dc11:', 'dc:', $prop) : $prop; |
| 160 | 160 | $value = $val->getValue(); |
| 161 | 161 | if ($value instanceof DateTime) { |
| 162 | - $val = Punic\Calendar::formatDate($value, 'full', $lang) . ' ' . Punic\Calendar::format($value, 'HH:mm:ss', $lang); |
|
| 162 | + $val = Punic\Calendar::formatDate($value, 'full', $lang).' '.Punic\Calendar::format($value, 'HH:mm:ss', $lang); |
|
| 163 | 163 | } |
| 164 | 164 | $ret[$prop][] = $val; |
| 165 | 165 | } |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | } |
| 271 | 271 | // don't know how to parse |
| 272 | 272 | $rev = $parts[2]; |
| 273 | - $datestr = $parts[3] . ' ' . $parts[4]; |
|
| 273 | + $datestr = $parts[3].' '.$parts[4]; |
|
| 274 | 274 | |
| 275 | 275 | return "$datestr (r$rev)"; |
| 276 | 276 | } |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | * Counts the statistics of the vocabulary. |
| 280 | 280 | * @return array of the concept/group counts |
| 281 | 281 | */ |
| 282 | - public function getStatistics($lang = '', $array=null, $group=null) |
|
| 282 | + public function getStatistics($lang = '', $array = null, $group = null) |
|
| 283 | 283 | { |
| 284 | 284 | $sparql = $this->getSparql(); |
| 285 | 285 | // find the number of concepts |
@@ -595,14 +595,14 @@ discard block |
||
| 595 | 595 | { |
| 596 | 596 | $changelist = $this->getSparql()->queryChangeList($clang, $offset, $prop); |
| 597 | 597 | $bydate = array(); |
| 598 | - foreach($changelist as $concept) { |
|
| 598 | + foreach ($changelist as $concept) { |
|
| 599 | 599 | $concept['datestring'] = Punic\Calendar::formatDate($concept['date'], 'medium', $lang); |
| 600 | - $bydate[Punic\Calendar::getMonthName($concept['date'], 'wide', $lang, true) . Punic\Calendar::format($concept['date'], ' y', $lang) ][strtolower($concept['prefLabel'])] = $concept; |
|
| 600 | + $bydate[Punic\Calendar::getMonthName($concept['date'], 'wide', $lang, true).Punic\Calendar::format($concept['date'], ' y', $lang)][strtolower($concept['prefLabel'])] = $concept; |
|
| 601 | 601 | } |
| 602 | 602 | return $bydate; |
| 603 | 603 | } |
| 604 | 604 | |
| 605 | - public function getTitle($lang=null) { |
|
| 605 | + public function getTitle($lang = null) { |
|
| 606 | 606 | return $this->config->getTitle($lang); |
| 607 | 607 | } |
| 608 | 608 | |
@@ -43,8 +43,9 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | // not found with selected language, try any language |
| 45 | 45 | $literal = $this->resource->getLiteral($property); |
| 46 | - if ($literal) |
|
| 47 | - return $literal->getValue(); |
|
| 46 | + if ($literal) { |
|
| 47 | + return $literal->getValue(); |
|
| 48 | + } |
|
| 48 | 49 | } |
| 49 | 50 | |
| 50 | 51 | /** |
@@ -85,8 +86,9 @@ discard block |
||
| 85 | 86 | public function getShortName() |
| 86 | 87 | { |
| 87 | 88 | $shortname = $this->getLiteral('skosmos:shortName'); |
| 88 | - if ($shortname) |
|
| 89 | - return $shortname; |
|
| 89 | + if ($shortname) { |
|
| 90 | + return $shortname; |
|
| 91 | + } |
|
| 90 | 92 | |
| 91 | 93 | // if no shortname exists fall back to the id |
| 92 | 94 | return $this->getId(); |
@@ -205,10 +207,12 @@ discard block |
||
| 205 | 207 | $ret = array(); |
| 206 | 208 | foreach ($resources as $res) { |
| 207 | 209 | $prop = $res->getURI(); |
| 208 | - if (EasyRdf_Namespace::shorten($prop) !== null) // shortening property labels if possible |
|
| 210 | + if (EasyRdf_Namespace::shorten($prop) !== null) { |
|
| 211 | + // shortening property labels if possible |
|
| 209 | 212 | { |
| 210 | 213 | $prop = EasyRdf_Namespace::shorten($prop); |
| 211 | 214 | } |
| 215 | + } |
|
| 212 | 216 | |
| 213 | 217 | $ret[] = $prop; |
| 214 | 218 | } |
@@ -225,10 +229,12 @@ discard block |
||
| 225 | 229 | $resources = $this->resource->allResources("skosmos:hasMultiLingualProperty"); |
| 226 | 230 | foreach ($resources as $res) { |
| 227 | 231 | $prop = $res->getURI(); |
| 228 | - if (EasyRdf_Namespace::shorten($prop) !== null) // shortening property labels if possible |
|
| 232 | + if (EasyRdf_Namespace::shorten($prop) !== null) { |
|
| 233 | + // shortening property labels if possible |
|
| 229 | 234 | { |
| 230 | 235 | $prop = EasyRdf_Namespace::shorten($prop); |
| 231 | 236 | } |
| 237 | + } |
|
| 232 | 238 | |
| 233 | 239 | if ($prop === $property) { |
| 234 | 240 | return true; |
@@ -329,11 +335,12 @@ discard block |
||
| 329 | 335 | public function getId() |
| 330 | 336 | { |
| 331 | 337 | $uriparts = explode("#", $this->resource->getURI()); |
| 332 | - if (count($uriparts) != 1) |
|
| 333 | - // hash namespace |
|
| 338 | + if (count($uriparts) != 1) { |
|
| 339 | + // hash namespace |
|
| 334 | 340 | { |
| 335 | 341 | return $uriparts[1]; |
| 336 | 342 | } |
| 343 | + } |
|
| 337 | 344 | |
| 338 | 345 | // slash namespace |
| 339 | 346 | $uriparts = explode("/", $this->resource->getURI()); |
@@ -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; |
@@ -67,8 +67,9 @@ |
||
| 67 | 67 | public function getSearchTerm() |
| 68 | 68 | { |
| 69 | 69 | $term = $this->request->getQueryParam('q') ? $this->request->getQueryParam('q') : $this->request->getQueryParam('query'); |
| 70 | - if (!$term && $this->rest) |
|
| 71 | - $term = $this->request->getQueryParam('label'); |
|
| 70 | + if (!$term && $this->rest) { |
|
| 71 | + $term = $this->request->getQueryParam('label'); |
|
| 72 | + } |
|
| 72 | 73 | $term = trim($term); // surrounding whitespace is not considered significant |
| 73 | 74 | return strpos($term, "*") === false ? $term . "*" : $term; // default to prefix search |
| 74 | 75 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | if ($this->rest) { |
| 82 | 82 | return $term; |
| 83 | 83 | } |
| 84 | - return strpos($term, "*") === false ? $term . "*" : $term; // default to prefix search |
|
| 84 | + return strpos($term, "*") === false ? $term."*" : $term; // default to prefix search |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | public function getContentLang() |
@@ -118,7 +118,7 @@ discard block |
||
| 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 | } |
@@ -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) { |
@@ -56,12 +56,16 @@ |
||
| 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 = ""; |
@@ -633,7 +633,7 @@ discard block |
||
| 633 | 633 | foreach ($graphs as $graph) { |
| 634 | 634 | $conditions[] = "?graph=<$graph>"; |
| 635 | 635 | } |
| 636 | - return "FILTER (" . implode('||', $conditions) . ")"; |
|
| 636 | + return "FILTER (".implode('||', $conditions).")"; |
|
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | /** |
@@ -643,16 +643,16 @@ discard block |
||
| 643 | 643 | * @return string sparql query clauses |
| 644 | 644 | */ |
| 645 | 645 | protected function formatLimitAndOffset($limit, $offset) { |
| 646 | - $limit = ($limit) ? 'LIMIT ' . $limit : ''; |
|
| 647 | - $offset = ($offset) ? 'OFFSET ' . $offset : ''; |
|
| 646 | + $limit = ($limit) ? 'LIMIT '.$limit : ''; |
|
| 647 | + $offset = ($offset) ? 'OFFSET '.$offset : ''; |
|
| 648 | 648 | // eliminating whitespace and line changes when the conditions aren't needed. |
| 649 | 649 | $limitandoffset = ''; |
| 650 | 650 | if ($limit && $offset) { |
| 651 | - $limitandoffset = "\n" . $limit . "\n" . $offset; |
|
| 651 | + $limitandoffset = "\n".$limit."\n".$offset; |
|
| 652 | 652 | } elseif ($limit) { |
| 653 | - $limitandoffset = "\n" . $limit; |
|
| 653 | + $limitandoffset = "\n".$limit; |
|
| 654 | 654 | } elseif ($offset) { |
| 655 | - $limitandoffset = "\n" . $offset; |
|
| 655 | + $limitandoffset = "\n".$offset; |
|
| 656 | 656 | } |
| 657 | 657 | |
| 658 | 658 | return $limitandoffset; |
@@ -672,7 +672,7 @@ discard block |
||
| 672 | 672 | } |
| 673 | 673 | } |
| 674 | 674 | |
| 675 | - return implode(' UNION ', $typePatterns);; |
|
| 675 | + return implode(' UNION ', $typePatterns); ; |
|
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | /** |
@@ -798,7 +798,7 @@ discard block |
||
| 798 | 798 | // if search language and UI/display language differ, must also consider case where there is no prefLabel in |
| 799 | 799 | // the display language; in that case, should use the label with the same language as the matched label |
| 800 | 800 | $labelcondFallback = ($searchLang != $lang) ? |
| 801 | - "OPTIONAL { # in case previous OPTIONAL block gives no labels\n" . |
|
| 801 | + "OPTIONAL { # in case previous OPTIONAL block gives no labels\n". |
|
| 802 | 802 | "?s skos:prefLabel ?label . FILTER (LANGMATCHES(LANG(?label), LANG(?match))) }" : ""; |
| 803 | 803 | |
| 804 | 804 | /* |
@@ -850,15 +850,15 @@ discard block |
||
| 850 | 850 | |
| 851 | 851 | $schemecond = ''; |
| 852 | 852 | if (!empty($schemes)) { |
| 853 | - foreach($schemes as $scheme) { |
|
| 853 | + foreach ($schemes as $scheme) { |
|
| 854 | 854 | $schemecond .= "?s skos:inScheme <$scheme> . "; |
| 855 | 855 | } |
| 856 | 856 | } |
| 857 | 857 | |
| 858 | 858 | // extra conditions for parent and group, if specified |
| 859 | - $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <" . $params->getParentLimit() . "> ." : ""; |
|
| 860 | - $groupcond = ($params->getGroupLimit()) ? "<" . $params->getGroupLimit() . "> skos:member ?s ." : ""; |
|
| 861 | - $pgcond = $parentcond . $groupcond; |
|
| 859 | + $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <".$params->getParentLimit()."> ." : ""; |
|
| 860 | + $groupcond = ($params->getGroupLimit()) ? "<".$params->getGroupLimit()."> skos:member ?s ." : ""; |
|
| 861 | + $pgcond = $parentcond.$groupcond; |
|
| 862 | 862 | |
| 863 | 863 | $orderextra = $this->isDefaultEndpoint() ? $this->graph : ''; |
| 864 | 864 | |
@@ -933,9 +933,9 @@ discard block |
||
| 933 | 933 | $hit['type'][] = $this->shortenUri($typeuri); |
| 934 | 934 | } |
| 935 | 935 | |
| 936 | - if(!empty($fields)) { |
|
| 936 | + if (!empty($fields)) { |
|
| 937 | 937 | foreach ($fields as $prop) { |
| 938 | - $propname = $prop . 's'; |
|
| 938 | + $propname = $prop.'s'; |
|
| 939 | 939 | if (isset($row->$propname)) { |
| 940 | 940 | foreach (explode("\n", $row->$propname->getValue()) as $line) { |
| 941 | 941 | $rdata = str_getcsv($line, ',', '"', '"'); |
@@ -1394,7 +1394,7 @@ discard block |
||
| 1394 | 1394 | if (!isset($row->label) || $row->label->getLang() === $lang) { |
| 1395 | 1395 | $ret[$row->object->getUri()] = $val; |
| 1396 | 1396 | } elseif ($row->label->getLang() === $fallbacklang) { |
| 1397 | - $val['label'] .= ' (' . $row->label->getLang() . ')'; |
|
| 1397 | + $val['label'] .= ' ('.$row->label->getLang().')'; |
|
| 1398 | 1398 | $ret[$row->object->getUri()] = $val; |
| 1399 | 1399 | } |
| 1400 | 1400 | } |
@@ -1494,7 +1494,7 @@ discard block |
||
| 1494 | 1494 | if ($row->label->getLang() == $lang) { |
| 1495 | 1495 | $label = $row->label->getValue(); |
| 1496 | 1496 | } else { |
| 1497 | - $label = $row->label->getValue() . " (" . $row->label->getLang() . ")"; |
|
| 1497 | + $label = $row->label->getValue()." (".$row->label->getLang().")"; |
|
| 1498 | 1498 | } |
| 1499 | 1499 | |
| 1500 | 1500 | } |
@@ -1661,7 +1661,7 @@ discard block |
||
| 1661 | 1661 | if (isset($row->childlabel)) { |
| 1662 | 1662 | $label = $row->childlabel->getValue(); |
| 1663 | 1663 | if ($row->childlabel->getLang() !== $lang) { |
| 1664 | - $label .= " (" . $row->childlabel->getLang() . ")"; |
|
| 1664 | + $label .= " (".$row->childlabel->getLang().")"; |
|
| 1665 | 1665 | } |
| 1666 | 1666 | |
| 1667 | 1667 | } |
@@ -1683,7 +1683,7 @@ discard block |
||
| 1683 | 1683 | if (isset($row->label)) { |
| 1684 | 1684 | $preflabel = $row->label->getValue(); |
| 1685 | 1685 | if ($row->label->getLang() !== $lang) { |
| 1686 | - $preflabel .= ' (' . $row->label->getLang() . ')'; |
|
| 1686 | + $preflabel .= ' ('.$row->label->getLang().')'; |
|
| 1687 | 1687 | } |
| 1688 | 1688 | |
| 1689 | 1689 | $ret[$uri]['prefLabel'] = $preflabel; |
@@ -1846,7 +1846,7 @@ discard block |
||
| 1846 | 1846 | if ($row->label->getLang() == $lang) { |
| 1847 | 1847 | $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue(); |
| 1848 | 1848 | } else { |
| 1849 | - $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue() . " (" . $row->label->getLang() . ")"; |
|
| 1849 | + $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue()." (".$row->label->getLang().")"; |
|
| 1850 | 1850 | } |
| 1851 | 1851 | |
| 1852 | 1852 | } |
@@ -1887,7 +1887,7 @@ discard block |
||
| 1887 | 1887 | */ |
| 1888 | 1888 | private function generateChangeListQuery($lang, $offset, $prop) { |
| 1889 | 1889 | $gcl = $this->graphClause; |
| 1890 | - $offset = ($offset) ? 'OFFSET ' . $offset : ''; |
|
| 1890 | + $offset = ($offset) ? 'OFFSET '.$offset : ''; |
|
| 1891 | 1891 | |
| 1892 | 1892 | $query = <<<EOQ |
| 1893 | 1893 | SELECT DISTINCT ?concept ?date ?label |
@@ -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)) { |
@@ -101,10 +101,12 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | private function initializeNamespaces() { |
| 103 | 103 | foreach ($this->namespaces as $prefix => $full_uri) { |
| 104 | - if ($prefix != '' && EasyRdf_Namespace::get($prefix) === null) // if not already defined |
|
| 104 | + if ($prefix != '' && EasyRdf_Namespace::get($prefix) === null) { |
|
| 105 | + // if not already defined |
|
| 105 | 106 | { |
| 106 | 107 | EasyRdf_Namespace::set($prefix, $full_uri); |
| 107 | 108 | } |
| 109 | + } |
|
| 108 | 110 | } |
| 109 | 111 | } |
| 110 | 112 | |
@@ -379,10 +381,12 @@ discard block |
||
| 379 | 381 | // register vocabulary ids as RDF namespace prefixes |
| 380 | 382 | $prefix = preg_replace('/\W+/', '', $voc->getId()); // strip non-word characters |
| 381 | 383 | try { |
| 382 | - if ($prefix != '' && EasyRdf_Namespace::get($prefix) === null) // if not already defined |
|
| 384 | + if ($prefix != '' && EasyRdf_Namespace::get($prefix) === null) { |
|
| 385 | + // if not already defined |
|
| 383 | 386 | { |
| 384 | 387 | EasyRdf_Namespace::set($prefix, $voc->getUriSpace()); |
| 385 | 388 | } |
| 389 | + } |
|
| 386 | 390 | |
| 387 | 391 | } catch (Exception $e) { |
| 388 | 392 | // not valid as namespace identifier, ignore |
@@ -65,15 +65,15 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -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 | } |