@@ -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 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * Get the localname of a concept in the vocabulary. If the URI is not |
| 110 | 110 | * in the URI space of this vocabulary, return the full URI. |
| 111 | 111 | * |
| 112 | - * @param $uri string full URI of concept |
|
| 112 | + * @param string $uri string full URI of concept |
|
| 113 | 113 | * @return string local name of concept, or original full URI if the local name cannot be determined |
| 114 | 114 | */ |
| 115 | 115 | public function getLocalName($uri) |
@@ -281,6 +281,8 @@ discard block |
||
| 281 | 281 | |
| 282 | 282 | /** |
| 283 | 283 | * Counts the statistics of the vocabulary. |
| 284 | + * @param string $array |
|
| 285 | + * @param string $group |
|
| 284 | 286 | * @return array of the concept/group counts |
| 285 | 287 | */ |
| 286 | 288 | public function getStatistics($lang = '', $array=null, $group=null) |
@@ -320,6 +322,7 @@ discard block |
||
| 320 | 322 | /** |
| 321 | 323 | * Gets the child relations of a concept and whether these children have more children. |
| 322 | 324 | * @param string $uri |
| 325 | + * @param string $lang |
|
| 323 | 326 | */ |
| 324 | 327 | public function getConceptChildren($uri, $lang) |
| 325 | 328 | { |
@@ -428,6 +431,8 @@ discard block |
||
| 428 | 431 | /** |
| 429 | 432 | * Lists the concepts available in the concept group. |
| 430 | 433 | * @param $clname |
| 434 | + * @param string $glname |
|
| 435 | + * @param string $clang |
|
| 431 | 436 | * @return array |
| 432 | 437 | */ |
| 433 | 438 | public function listConceptGroupContents($glname, $clang) |
@@ -595,6 +600,7 @@ discard block |
||
| 595 | 600 | * Returns a list of recently changed or entirely new concepts. |
| 596 | 601 | * @param string $clang content language for the labels |
| 597 | 602 | * @param string $lang UI language for the dates |
| 603 | + * @param string $prop |
|
| 598 | 604 | * @return Array |
| 599 | 605 | */ |
| 600 | 606 | public function getChangeList($prop, $clang, $lang, $offset) |
@@ -608,6 +614,9 @@ discard block |
||
| 608 | 614 | return $bydate; |
| 609 | 615 | } |
| 610 | 616 | |
| 617 | + /** |
|
| 618 | + * @param string $lang |
|
| 619 | + */ |
|
| 611 | 620 | public function getTitle($lang=null) { |
| 612 | 621 | return $this->config->getTitle($lang); |
| 613 | 622 | } |
@@ -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)) { |
@@ -55,6 +55,7 @@ |
||
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | 57 | * Steps back, restoring the previous character or statement read() to the input buffer. |
| 58 | + * @param string $chars |
|
| 58 | 59 | */ |
| 59 | 60 | protected function unread($chars) |
| 60 | 61 | { |
@@ -79,10 +79,12 @@ |
||
| 79 | 79 | if ($sortable !== null) { |
| 80 | 80 | uksort($sortable, array($this, 'mycompare')); |
| 81 | 81 | foreach ($sortable as $prop => $vals) { |
| 82 | - if (is_array($prop)) // the ConceptProperty objects have their own sorting methods |
|
| 82 | + if (is_array($prop)) { |
|
| 83 | + // the ConceptProperty objects have their own sorting methods |
|
| 83 | 84 | { |
| 84 | 85 | ksort($sortable[$prop]); |
| 85 | 86 | } |
| 87 | + } |
|
| 86 | 88 | } |
| 87 | 89 | } |
| 88 | 90 | return $sortable; |
@@ -3,6 +3,9 @@ |
||
| 3 | 3 | class LabelSkosXL extends DataObject |
| 4 | 4 | { |
| 5 | 5 | |
| 6 | + /** |
|
| 7 | + * @param Model $model |
|
| 8 | + */ |
|
| 6 | 9 | public function __construct($model, $resource) |
| 7 | 10 | { |
| 8 | 11 | parent::__construct($model, $resource); |
@@ -69,8 +69,9 @@ |
||
| 69 | 69 | public function getSearchTerm() |
| 70 | 70 | { |
| 71 | 71 | $term = $this->request->getQueryParamRaw('q') ? $this->request->getQueryParamRaw('q') : $this->request->getQueryParamRaw('query'); |
| 72 | - if (!$term && $this->rest) |
|
| 73 | - $term = $this->request->getQueryParamRaw('label'); |
|
| 72 | + if (!$term && $this->rest) { |
|
| 73 | + $term = $this->request->getQueryParamRaw('label'); |
|
| 74 | + } |
|
| 74 | 75 | $term = trim($term); // surrounding whitespace is not considered significant |
| 75 | 76 | if ($this->rest) { |
| 76 | 77 | return $term; |
@@ -400,7 +400,9 @@ discard block |
||
| 400 | 400 | $hits[] = $res; |
| 401 | 401 | } |
| 402 | 402 | } |
| 403 | - if (sizeof($hits) > 0) return $hits; |
|
| 403 | + if (sizeof($hits) > 0) { |
|
| 404 | + return $hits; |
|
| 405 | + } |
|
| 404 | 406 | |
| 405 | 407 | // case 2: case-insensitive match on preferred label |
| 406 | 408 | foreach ($results as $res) { |
@@ -408,7 +410,9 @@ discard block |
||
| 408 | 410 | $hits[] = $res; |
| 409 | 411 | } |
| 410 | 412 | } |
| 411 | - if (sizeof($hits) > 0) return $hits; |
|
| 413 | + if (sizeof($hits) > 0) { |
|
| 414 | + return $hits; |
|
| 415 | + } |
|
| 412 | 416 | |
| 413 | 417 | if ($lang === null) { |
| 414 | 418 | // case 1A: exact match on preferred label in any language |
@@ -419,7 +423,9 @@ discard block |
||
| 419 | 423 | $hits[] = $res; |
| 420 | 424 | } |
| 421 | 425 | } |
| 422 | - if (sizeof($hits) > 0) return $hits; |
|
| 426 | + if (sizeof($hits) > 0) { |
|
| 427 | + return $hits; |
|
| 428 | + } |
|
| 423 | 429 | |
| 424 | 430 | // case 2A: case-insensitive match on preferred label in any language |
| 425 | 431 | foreach ($results as $res) { |
@@ -429,7 +435,9 @@ discard block |
||
| 429 | 435 | $hits[] = $res; |
| 430 | 436 | } |
| 431 | 437 | } |
| 432 | - if (sizeof($hits) > 0) return $hits; |
|
| 438 | + if (sizeof($hits) > 0) { |
|
| 439 | + return $hits; |
|
| 440 | + } |
|
| 433 | 441 | } |
| 434 | 442 | |
| 435 | 443 | // case 3: exact match on alternate label |
@@ -438,7 +446,9 @@ discard block |
||
| 438 | 446 | $hits[] = $res; |
| 439 | 447 | } |
| 440 | 448 | } |
| 441 | - if (sizeof($hits) > 0) return $hits; |
|
| 449 | + if (sizeof($hits) > 0) { |
|
| 450 | + return $hits; |
|
| 451 | + } |
|
| 442 | 452 | |
| 443 | 453 | |
| 444 | 454 | // case 4: case-insensitive match on alternate label |
@@ -447,7 +457,9 @@ discard block |
||
| 447 | 457 | $hits[] = $res; |
| 448 | 458 | } |
| 449 | 459 | } |
| 450 | - if (sizeof($hits) > 0) return $hits; |
|
| 460 | + if (sizeof($hits) > 0) { |
|
| 461 | + return $hits; |
|
| 462 | + } |
|
| 451 | 463 | |
| 452 | 464 | return $hits; |
| 453 | 465 | } |
@@ -97,6 +97,9 @@ discard block |
||
| 97 | 97 | return $this->returnJson($ret); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | + /** |
|
| 101 | + * @param Request $request |
|
| 102 | + */ |
|
| 100 | 103 | private function constructSearchParameters($request) |
| 101 | 104 | { |
| 102 | 105 | $parameters = new ConceptSearchParameters($request, $this->model->getConfig(), true); |
@@ -112,6 +115,10 @@ discard block |
||
| 112 | 115 | return $parameters; |
| 113 | 116 | } |
| 114 | 117 | |
| 118 | + /** |
|
| 119 | + * @param Request $request |
|
| 120 | + * @param ConceptSearchParameters $parameters |
|
| 121 | + */ |
|
| 115 | 122 | private function transformSearchResults($request, $results, $parameters) |
| 116 | 123 | { |
| 117 | 124 | // before serializing to JSON, get rid of the Vocabulary object that came with each resource |
@@ -407,6 +414,10 @@ discard block |
||
| 407 | 414 | return $this->returnJson($ret); |
| 408 | 415 | } |
| 409 | 416 | |
| 417 | + /** |
|
| 418 | + * @param string $label |
|
| 419 | + * @param string $lang |
|
| 420 | + */ |
|
| 410 | 421 | private function findLookupHits($results, $label, $lang) |
| 411 | 422 | { |
| 412 | 423 | $hits = array(); |
@@ -468,6 +479,9 @@ discard block |
||
| 468 | 479 | return $hits; |
| 469 | 480 | } |
| 470 | 481 | |
| 482 | + /** |
|
| 483 | + * @param string $lang |
|
| 484 | + */ |
|
| 471 | 485 | private function transformLookupResults($lang, $hits) |
| 472 | 486 | { |
| 473 | 487 | if (sizeof($hits) == 0) { |
@@ -539,6 +553,9 @@ discard block |
||
| 539 | 553 | return $this->returnJson($ret); |
| 540 | 554 | } |
| 541 | 555 | |
| 556 | + /** |
|
| 557 | + * @param Request $request |
|
| 558 | + */ |
|
| 542 | 559 | private function redirectToVocabData($request) { |
| 543 | 560 | $urls = $request->getVocab()->getConfig()->getDataURLs(); |
| 544 | 561 | if (sizeof($urls) == 0) { |
@@ -564,6 +581,10 @@ discard block |
||
| 564 | 581 | } |
| 565 | 582 | } |
| 566 | 583 | |
| 584 | + /** |
|
| 585 | + * @param string $results |
|
| 586 | + * @param string $format |
|
| 587 | + */ |
|
| 567 | 588 | private function returnDataResults($results, $format) { |
| 568 | 589 | if ($format == 'application/ld+json' || $format == 'application/json') { |
| 569 | 590 | // further compact JSON-LD document using a context |
@@ -700,6 +721,12 @@ discard block |
||
| 700 | 721 | return $this->returnJson($ret); |
| 701 | 722 | } |
| 702 | 723 | |
| 724 | + /** |
|
| 725 | + * @param string $uri |
|
| 726 | + * @param string $lang |
|
| 727 | + * @param string $propname |
|
| 728 | + * @param string $propuri |
|
| 729 | + */ |
|
| 703 | 730 | private function transformPropertyResults($uri, $lang, $objects, $propname, $propuri) |
| 704 | 731 | { |
| 705 | 732 | $results = array(); |
@@ -714,6 +741,14 @@ discard block |
||
| 714 | 741 | ); |
| 715 | 742 | } |
| 716 | 743 | |
| 744 | + /** |
|
| 745 | + * @param string $uri |
|
| 746 | + * @param string $lang |
|
| 747 | + * @param string $tpropname |
|
| 748 | + * @param string $tpropuri |
|
| 749 | + * @param string $dpropname |
|
| 750 | + * @param string $dpropuri |
|
| 751 | + */ |
|
| 717 | 752 | private function transformTransitivePropertyResults($uri, $lang, $objects, $tpropname, $tpropuri, $dpropname, $dpropuri) |
| 718 | 753 | { |
| 719 | 754 | $results = array(); |
@@ -40,8 +40,7 @@ |
||
| 40 | 40 | $ret[$name] = array(); |
| 41 | 41 | if ($raw) { |
| 42 | 42 | $ret[$name] = $files[$type]; |
| 43 | - } |
|
| 44 | - else { |
|
| 43 | + } else { |
|
| 45 | 44 | foreach ($files[$type] as $file) { |
| 46 | 45 | array_push($ret[$name], 'plugins/' . $name . '/' . $file); |
| 47 | 46 | } |
@@ -74,7 +74,9 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function getQueryParam($paramName) |
| 76 | 76 | { |
| 77 | - if (!isset($this->queryParams[$paramName])) return null; |
|
| 77 | + if (!isset($this->queryParams[$paramName])) { |
|
| 78 | + return null; |
|
| 79 | + } |
|
| 78 | 80 | $val = filter_var($this->queryParams[$paramName], FILTER_SANITIZE_STRING); |
| 79 | 81 | return ($val !== null ? str_replace('\\', '', $val) : null); |
| 80 | 82 | } |
@@ -91,7 +93,9 @@ discard block |
||
| 91 | 93 | |
| 92 | 94 | public function getQueryParamPOST($paramName) |
| 93 | 95 | { |
| 94 | - if (!isset($this->queryParamsPOST[$paramName])) return null; |
|
| 96 | + if (!isset($this->queryParamsPOST[$paramName])) { |
|
| 97 | + return null; |
|
| 98 | + } |
|
| 95 | 99 | return filter_var($this->queryParamsPOST[$paramName], FILTER_SANITIZE_STRING); |
| 96 | 100 | } |
| 97 | 101 | |
@@ -106,7 +110,9 @@ discard block |
||
| 106 | 110 | |
| 107 | 111 | public function getServerConstant($paramName) |
| 108 | 112 | { |
| 109 | - if (!isset($this->serverConstants[$paramName])) return null; |
|
| 113 | + if (!isset($this->serverConstants[$paramName])) { |
|
| 114 | + return null; |
|
| 115 | + } |
|
| 110 | 116 | return filter_var($this->serverConstants[$paramName], FILTER_SANITIZE_STRING); |
| 111 | 117 | } |
| 112 | 118 | |
@@ -239,9 +245,11 @@ discard block |
||
| 239 | 245 | */ |
| 240 | 246 | public function setVocab($vocabid) |
| 241 | 247 | { |
| 242 | - if (strpos($vocabid, ' ') !== false) // if there are multiple vocabularies just storing the string |
|
| 248 | + if (strpos($vocabid, ' ') !== false) { |
|
| 249 | + // if there are multiple vocabularies just storing the string |
|
| 243 | 250 | { |
| 244 | 251 | $this->setVocabids($vocabid); |
| 252 | + } |
|
| 245 | 253 | } else { |
| 246 | 254 | $this->vocab = $this->model->getVocabulary($vocabid); |
| 247 | 255 | } |