@@ -25,8 +25,7 @@ |
||
| 25 | 25 | public function store($key, $value, $ttl=3600) { |
| 26 | 26 | if (function_exists('apc_store')) { |
| 27 | 27 | return apc_store($key, $value); |
| 28 | - } |
|
| 29 | - else if (function_exists('apcu_store')) { |
|
| 28 | + } else if (function_exists('apcu_store')) { |
|
| 30 | 29 | return apcu_store($key, $value, $ttl); |
| 31 | 30 | } |
| 32 | 31 | } |
@@ -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(); |
@@ -231,10 +233,12 @@ discard block |
||
| 231 | 233 | $ret = array(); |
| 232 | 234 | foreach ($resources as $res) { |
| 233 | 235 | $prop = $res->getURI(); |
| 234 | - if (EasyRdf\RdfNamespace::shorten($prop) !== null) // shortening property labels if possible |
|
| 236 | + if (EasyRdf\RdfNamespace::shorten($prop) !== null) { |
|
| 237 | + // shortening property labels if possible |
|
| 235 | 238 | { |
| 236 | 239 | $prop = EasyRdf\RdfNamespace::shorten($prop); |
| 237 | 240 | } |
| 241 | + } |
|
| 238 | 242 | |
| 239 | 243 | $ret[] = $prop; |
| 240 | 244 | } |
@@ -251,10 +255,12 @@ discard block |
||
| 251 | 255 | $resources = $this->resource->allResources("skosmos:hasMultiLingualProperty"); |
| 252 | 256 | foreach ($resources as $res) { |
| 253 | 257 | $prop = $res->getURI(); |
| 254 | - if (EasyRdf\RdfNamespace::shorten($prop) !== null) // shortening property labels if possible |
|
| 258 | + if (EasyRdf\RdfNamespace::shorten($prop) !== null) { |
|
| 259 | + // shortening property labels if possible |
|
| 255 | 260 | { |
| 256 | 261 | $prop = EasyRdf\RdfNamespace::shorten($prop); |
| 257 | 262 | } |
| 263 | + } |
|
| 258 | 264 | |
| 259 | 265 | if ($prop === $property) { |
| 260 | 266 | return true; |
@@ -362,11 +368,12 @@ discard block |
||
| 362 | 368 | public function getId() |
| 363 | 369 | { |
| 364 | 370 | $uriparts = explode("#", $this->resource->getURI()); |
| 365 | - if (count($uriparts) != 1) |
|
| 366 | - // hash namespace |
|
| 371 | + if (count($uriparts) != 1) { |
|
| 372 | + // hash namespace |
|
| 367 | 373 | { |
| 368 | 374 | return $uriparts[1]; |
| 369 | 375 | } |
| 376 | + } |
|
| 370 | 377 | |
| 371 | 378 | // slash namespace |
| 372 | 379 | $uriparts = explode("/", $this->resource->getURI()); |
@@ -394,10 +401,12 @@ discard block |
||
| 394 | 401 | $ret = array(); |
| 395 | 402 | foreach ($resources as $res) { |
| 396 | 403 | $prop = $res->getURI(); |
| 397 | - if (EasyRdf\RdfNamespace::shorten($prop) !== null) // prefixing if possible |
|
| 404 | + if (EasyRdf\RdfNamespace::shorten($prop) !== null) { |
|
| 405 | + // prefixing if possible |
|
| 398 | 406 | { |
| 399 | 407 | $prop = EasyRdf\RdfNamespace::shorten($prop); |
| 400 | 408 | } |
| 409 | + } |
|
| 401 | 410 | |
| 402 | 411 | $ret[] = $prop; |
| 403 | 412 | } |
@@ -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 | } |