Permalink
Browse files

Merge pull request #731 from pascalchevrel/return_no_variable

fix #730: small refactoring of  variable use in api
  • Loading branch information...
pascalchevrel committed Apr 18, 2016
2 parents 63de56d + ec5a40f commit 228916bd8bae8e55d3aa8a3558944fd0e70c39f4
View
@@ -16,42 +16,42 @@
case 'entity':
$repo = $request->parameters[2];
$entity = $request->extra_parameters['id'];
include MODELS . 'api/entity.php';
$json = include MODELS . 'api/entity.php';
if (empty($json)) {
$request->error = 'Entity not available';
$json = $request->invalidAPICall();
}
break;
case 'locales':
include MODELS . 'api/repository_locales.php';
$json = include MODELS . 'api/repository_locales.php';
break;
case 'repositories':
include MODELS . 'api/repositories_list.php';
$json = include MODELS . 'api/repositories_list.php';
break;
case 'search':
// We chain 2 queries to match both strings and entities
if ($request->parameters[2] == 'all') {
$request->parameters[2] = 'entities';
include MODELS . 'api/repository_search.php';
$json = include MODELS . 'api/repository_search.php';
$entities_json = $json;
$request->parameters[2] = 'strings';
include MODELS . 'api/repository_search.php';
$json = include MODELS . 'api/repository_search.php';
$strings_json = $json;
$json = array_merge($entities_json, $strings_json);
} else {
include MODELS . 'api/repository_search.php';
$json = include MODELS . 'api/repository_search.php';
}
break;
case 'suggestions':
include MODELS . 'api/suggestions.php';
$json = include MODELS . 'api/suggestions.php';
break;
case 'tm':
include MODELS . 'api/translation_memory.php';
$json = include MODELS . 'api/translation_memory.php';
break;
case 'versions':
include MODELS . 'api/versions.php';
$json = include MODELS . 'api/versions.php';
break;
default:
return false;
@@ -26,4 +26,4 @@
Cache::setKey($cache_id, $translations);
}
return $json = $translations;
return $translations;
@@ -7,4 +7,4 @@
}
// Default to list all existing repositories
return $json = Project::getRepositories();
return Project::getRepositories();
@@ -1,4 +1,4 @@
<?php
namespace Transvision;
$json = Project::getRepositoryLocales($request->parameters[2]);
return Project::getRepositoryLocales($request->parameters[2]);
@@ -71,7 +71,7 @@
array_splice($source_strings_merged, 500);
array_splice($target_strings_merged, 500);
return $json = ShowResults::getRepositorySearchResults(
return ShowResults::getRepositorySearchResults(
$entities_merged,
[$source_strings_merged, $target_strings_merged]
);
@@ -55,7 +55,7 @@
return $value;
};
return $json = ShowResults::getSuggestionsResults(
return ShowResults::getSuggestionsResults(
$source_strings_merged,
$target_strings_merged,
$search->getSearchTerms(),
@@ -61,7 +61,7 @@
unset($source_strings, $target_strings);
}
return $json = ShowResults::getTranslationMemoryResults(
return ShowResults::getTranslationMemoryResults(
$output,
$search->getSearchTerms(),
$get_option('max_results'), // Cap results with the ?max_results=number option
@@ -1,4 +1,4 @@
<?php
namespace Transvision;
return $json = $request->api_versions;
return $request->api_versions;

0 comments on commit 228916b

Please sign in to comment.