diff --git a/controller/Controller.php b/controller/Controller.php
index 39a5c8f74..21992b952 100644
--- a/controller/Controller.php
+++ b/controller/Controller.php
@@ -78,8 +78,7 @@ protected function negotiateFormat($choices, $accept, $format)
// if there was no proposed format, negotiate a suitable format
header('Vary: Accept'); // inform caches that a decision was made based on Accept header
$best = $this->negotiator->getBest($accept, $choices);
- $format = ($best !== null) ? $best->getValue() : null;
- return $format;
+ return ($best !== null) ? $best->getValue() : null;
}
private function isSecure()
@@ -106,8 +105,7 @@ private function guessBaseHref()
$port = filter_input(INPUT_SERVER, 'SERVER_PORT', FILTER_SANITIZE_STRING);
$disp_port = ($port == 80 || $port == 443) ? '' : ":$port";
$domain = filter_input(INPUT_SERVER, 'SERVER_NAME', FILTER_SANITIZE_STRING);
- $full_url = "$protocol://{$domain}{$disp_port}{$base_url}";
- return $full_url;
+ return "$protocol://{$domain}{$disp_port}{$base_url}";
}
public function getBaseHref()
diff --git a/controller/Honeypot.php b/controller/Honeypot.php
index 509e66d2c..917fc9a95 100644
--- a/controller/Honeypot.php
+++ b/controller/Honeypot.php
@@ -32,11 +32,10 @@ public function generate($honey_name, $honey_time)
{
// Encrypt the current time
$honey_time_encrypted = $this->getEncryptedTime();
- $html = '
' . "\r\n" .
- '
' . "\r\n" .
- '
' . "\r\n" .
+ return '
' . "\r\n" .
+ '' . "\r\n" .
+ '' . "\r\n" .
'
';
- return $html;
}
/**
* Validate honeypot is empty
diff --git a/controller/RestController.php b/controller/RestController.php
index a0acb01c5..48f9c1b64 100644
--- a/controller/RestController.php
+++ b/controller/RestController.php
@@ -707,12 +707,11 @@ private function transformPropertyResults($uri, $lang, $objects, $propname, $pro
$results[] = array('uri' => $objuri, 'prefLabel' => $vals['label']);
}
- $ret = array_merge_recursive($this->context, array(
+ return array_merge_recursive($this->context, array(
'@context' => array('prefLabel' => 'skos:prefLabel', $propname => $propuri, '@language' => $lang),
'uri' => $uri,
$propname => $results)
);
- return $ret;
}
private function transformTransitivePropertyResults($uri, $lang, $objects, $tpropname, $tpropuri, $dpropname, $dpropuri)
@@ -726,12 +725,11 @@ private function transformTransitivePropertyResults($uri, $lang, $objects, $tpro
$results[$objuri] = $result;
}
- $ret = array_merge_recursive($this->context, array(
+ return array_merge_recursive($this->context, array(
'@context' => array('prefLabel' => 'skos:prefLabel', $dpropname => array('@id' => $dpropuri, '@type' => '@id'), $tpropname => array('@id' => $tpropuri, '@container' => '@index'), '@language' => $lang),
'uri' => $uri,
$tpropname => $results)
);
- return $ret;
}
/**
diff --git a/controller/WebController.php b/controller/WebController.php
index 15a577ef2..fb9430298 100644
--- a/controller/WebController.php
+++ b/controller/WebController.php
@@ -373,8 +373,7 @@ private function createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender)
}
$service = $this->model->getConfig()->getServiceName();
- $headers .= "From: $fromName via $service <$sender>";
- return $headers;
+ return $headers . "From: $fromName via $service <$sender>";
}
/**
diff --git a/model/Concept.php b/model/Concept.php
index a961f97d2..3b2a4c732 100644
--- a/model/Concept.php
+++ b/model/Concept.php
@@ -451,9 +451,7 @@ public function getMappingProperties(array $whitelist = null)
}
// sorting the properties to a order preferred in the Skosmos concept page.
- $ret = $this->arbitrarySort($ret);
-
- return $ret;
+ return $this->arbitrarySort($ret);
}
/**
@@ -632,8 +630,7 @@ public function getProperties()
$ret = $this->removeDuplicatePropertyValues($ret, $duplicates);
// sorting the properties to the order preferred in the Skosmos concept page.
- $ret = $this->arbitrarySort($ret);
- return $ret;
+ return $this->arbitrarySort($ret);
}
/**
@@ -904,8 +901,6 @@ public function dumpJsonLd() {
}
}
$compactJsonLD = \ML\JsonLD\JsonLD::compact($this->graph->serialise('jsonld'), json_encode($context));
- $results = \ML\JsonLD\JsonLD::toString($compactJsonLD);
-
- return $results;
+ return \ML\JsonLD\JsonLD::toString($compactJsonLD);
}
}
diff --git a/model/ConceptMappingPropertyValue.php b/model/ConceptMappingPropertyValue.php
index c46777629..2b6fa6f4e 100644
--- a/model/ConceptMappingPropertyValue.php
+++ b/model/ConceptMappingPropertyValue.php
@@ -79,8 +79,7 @@ private function queryLabel($lang = '', $queryExVocabs = true)
}
// using URI as label if nothing else has been found.
- $label = $this->resource->shorten() ? $this->resource->shorten() : $this->resource->getUri();
- return $label;
+ return $this->resource->shorten() ? $this->resource->shorten() : $this->resource->getUri();
}
private function getResourceLabel($res, $lang = '') {
@@ -108,8 +107,7 @@ public function getUri()
public function getExVocab()
{
- $exvocab = $this->model->guessVocabularyFromURI($this->getUri(), $this->vocab->getId());
- return $exvocab;
+ return $this->model->guessVocabularyFromURI($this->getUri(), $this->vocab->getId());
}
public function getVocab()
diff --git a/model/ConceptPropertyValue.php b/model/ConceptPropertyValue.php
index ff5c804ed..bfec6bcae 100644
--- a/model/ConceptPropertyValue.php
+++ b/model/ConceptPropertyValue.php
@@ -80,8 +80,7 @@ public function getLabel($lang = '', $fallbackToUri = 'uri')
if ($fallbackToUri == 'uri') {
// return uri if no label is found
- $label = $this->resource->shorten() ? $this->resource->shorten() : $this->getUri();
- return $label;
+ return $this->resource->shorten() ? $this->resource->shorten() : $this->getUri();
}
return null;
}
diff --git a/model/ConceptSearchParameters.php b/model/ConceptSearchParameters.php
index 46213d39e..e710f43be 100644
--- a/model/ConceptSearchParameters.php
+++ b/model/ConceptSearchParameters.php
@@ -48,8 +48,7 @@ public function getVocabIds()
return ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : null;
}
$vocabs = $this->getVocabs();
- $ret = isset($vocabs[0]) ? array($vocabs[0]->getId()) : null;
- return $ret;
+ return isset($vocabs[0]) ? array($vocabs[0]->getId()) : null;
}
public function setVocabularies($vocabs)
diff --git a/model/Model.php b/model/Model.php
index 35bc770bf..0bbf73cd3 100644
--- a/model/Model.php
+++ b/model/Model.php
@@ -401,9 +401,7 @@ public function getVocabularyCategories()
public function getClassificationLabel($lang)
{
$cats = $this->globalConfig->getGraph()->allOfType('skos:ConceptScheme');
- $label = $cats ? $cats[0]->label($lang) : null;
-
- return $label;
+ return $cats ? $cats[0]->label($lang) : null;
}
/**
diff --git a/resource/js/docready.js b/resource/js/docready.js
index 5fa660ef3..b451e8fff 100644
--- a/resource/js/docready.js
+++ b/resource/js/docready.js
@@ -41,7 +41,7 @@ $(function() { // DOCUMENT READY
});
return removeThese.join(' ');
});
- if (settings.url.indexOf('index/' !== -1)) {
+ if (settings.url.indexOf('index/') !== -1) {
$(".sidebar-grey").mCustomScrollbar({
alwaysShowScrollbar: 1,
scrollInertia: 0,
@@ -247,8 +247,8 @@ $(function() { // DOCUMENT READY
var $delayedSpinner = $("
" + loading_text + "…
");
// adds a delay before showing the spinner configured above
- function delaySpinner(loading) {
- loading = setTimeout(function() { $('.concept-spinner').show() }, 500);
+ function delaySpinner() {
+ return setTimeout(function() { $('.concept-spinner').show() }, 500);
}
function ajaxConceptMapping(data) {
@@ -276,11 +276,10 @@ $(function() { // DOCUMENT READY
var historyUrl = (clang !== lang) ? targetUrl + '?' + parameters : targetUrl;
$('#hier-trigger').attr('href', targetUrl);
var $content = $('.content').empty().append($delayedSpinner.hide());
- var loading;
+ var loading = delaySpinner();
$.ajax({
url : targetUrl,
data: parameters,
- beforeSend: delaySpinner(loading),
complete: clearTimeout(loading),
success : function(data) {
$content.empty();
@@ -307,10 +306,9 @@ $(function() { // DOCUMENT READY
$('.activated-concept').removeClass('activated-concept');
$(this).addClass('activated-concept');
var $content = $('.content').empty().append($delayedSpinner.hide());
- var loading;
+ var loading = delaySpinner();
$.ajax({
url : event.target.href,
- beforeSend: delaySpinner(loading),
complete: clearTimeout(loading),
success : function(data) {
if (window.history.pushState) { window.history.pushState({}, null, event.target.href); }
@@ -433,12 +431,10 @@ $(function() { // DOCUMENT READY
$(document).on('click','div.group-hierarchy a',
function(event) {
var $content = $('.content').empty().append($delayedSpinner.hide());
- var loading;
+ var loading = delaySpinner();
// ajaxing the sidebar content
$.ajax({
url : event.target.href,
- beforeSend: delaySpinner(loading),
- complete: clearTimeout(loading),
success : function(data) {
initHierarchyQtip();
$('#hier-trigger').attr('href', event.target.href);
@@ -663,7 +659,6 @@ $(function() { // DOCUMENT READY
},
ajax: {
beforeSend: function(jqXHR, settings) {
- wildcard = ($('#search-field').val().indexOf('*') === -1) ? '*' : '';
var vocabString = $('.frontpage').length ? vocabSelectionString : vocab;
var parameters = $.param({'vocab' : vocabString, 'lang' : qlang, 'labellang' : qlang});
// if the search has been targeted at all languages by clicking the checkbox
diff --git a/tests/DataObjectTest.php b/tests/DataObjectTest.php
index 339042b81..d98010371 100644
--- a/tests/DataObjectTest.php
+++ b/tests/DataObjectTest.php
@@ -12,7 +12,8 @@ class DataObjectTest extends PHPUnit\Framework\TestCase
*/
public function testConstructorNoArguments()
{
- new DataObject(null, null);
+ $obj = new DataObject(null, null);
+ $this->assertNotNull($obj);
}
}
diff --git a/tests/GlobalConfigTest.php b/tests/GlobalConfigTest.php
index e394c59bd..86598e4a4 100644
--- a/tests/GlobalConfigTest.php
+++ b/tests/GlobalConfigTest.php
@@ -138,7 +138,8 @@ public function testGetGlobalPlugins()
*/
public function testInitializeConfigWithoutGraph()
{
- new GlobalConfig('/../tests/testconfig-nograph.ttl');
+ $conf = new GlobalConfig('/../tests/testconfig-nograph.ttl');
+ $this->assertNotNull($conf);
}
/**
@@ -146,7 +147,8 @@ public function testInitializeConfigWithoutGraph()
*/
public function testInexistentFile()
{
- new GlobalConfig('/../tests/testconfig-idonotexist.ttl');
+ $conf = new GlobalConfig('/../tests/testconfig-idonotexist.ttl');
+ $this->assertNotNull($conf);
}
// --- tests for some default values
diff --git a/tests/ModelTest.php b/tests/ModelTest.php
index 402adea2a..2f6be1970 100644
--- a/tests/ModelTest.php
+++ b/tests/ModelTest.php
@@ -24,7 +24,8 @@ protected function tearDown() {
*/
public function testConstructorWithConfig()
{
- new Model(new GlobalConfig('/../tests/testconfig.ttl'));
+ $model = new Model(new GlobalConfig('/../tests/testconfig.ttl'));
+ $this->assertNotNull($model);
}
/**
diff --git a/tests/VocabularyCategoryTest.php b/tests/VocabularyCategoryTest.php
index 10ac7cdb2..0aaae94fd 100644
--- a/tests/VocabularyCategoryTest.php
+++ b/tests/VocabularyCategoryTest.php
@@ -20,7 +20,8 @@ protected function setUp() {
* @expectedExceptionMessage Invalid constructor parameter given to DataObject.
*/
public function testConstructorWithInvalidParameters() {
- new VocabularyCategory('invalid', 'invalid');
+ $vcat = new VocabularyCategory('invalid', 'invalid');
+ $this->assertNotNull($vcat);
}
/**