Skip to content

Commit 228916b

Browse files
committed
Merge pull request #731 from pascalchevrel/return_no_variable
fix #730: small refactoring of variable use in api
2 parents 63de56d + ec5a40f commit 228916b

8 files changed

Lines changed: 16 additions & 16 deletions

File tree

app/controllers/api.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,42 +16,42 @@
1616
case 'entity':
1717
$repo = $request->parameters[2];
1818
$entity = $request->extra_parameters['id'];
19-
include MODELS . 'api/entity.php';
19+
$json = include MODELS . 'api/entity.php';
2020
if (empty($json)) {
2121
$request->error = 'Entity not available';
2222
$json = $request->invalidAPICall();
2323
}
2424
break;
2525
case 'locales':
26-
include MODELS . 'api/repository_locales.php';
26+
$json = include MODELS . 'api/repository_locales.php';
2727
break;
2828
case 'repositories':
29-
include MODELS . 'api/repositories_list.php';
29+
$json = include MODELS . 'api/repositories_list.php';
3030
break;
3131
case 'search':
3232
// We chain 2 queries to match both strings and entities
3333
if ($request->parameters[2] == 'all') {
3434
$request->parameters[2] = 'entities';
35-
include MODELS . 'api/repository_search.php';
35+
$json = include MODELS . 'api/repository_search.php';
3636
$entities_json = $json;
3737

3838
$request->parameters[2] = 'strings';
39-
include MODELS . 'api/repository_search.php';
39+
$json = include MODELS . 'api/repository_search.php';
4040
$strings_json = $json;
4141

4242
$json = array_merge($entities_json, $strings_json);
4343
} else {
44-
include MODELS . 'api/repository_search.php';
44+
$json = include MODELS . 'api/repository_search.php';
4545
}
4646
break;
4747
case 'suggestions':
48-
include MODELS . 'api/suggestions.php';
48+
$json = include MODELS . 'api/suggestions.php';
4949
break;
5050
case 'tm':
51-
include MODELS . 'api/translation_memory.php';
51+
$json = include MODELS . 'api/translation_memory.php';
5252
break;
5353
case 'versions':
54-
include MODELS . 'api/versions.php';
54+
$json = include MODELS . 'api/versions.php';
5555
break;
5656
default:
5757
return false;

app/models/api/entity.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@
2626
Cache::setKey($cache_id, $translations);
2727
}
2828

29-
return $json = $translations;
29+
return $translations;

app/models/api/repositories_list.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
}
88

99
// Default to list all existing repositories
10-
return $json = Project::getRepositories();
10+
return Project::getRepositories();
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?php
22
namespace Transvision;
33

4-
$json = Project::getRepositoryLocales($request->parameters[2]);
4+
return Project::getRepositoryLocales($request->parameters[2]);

app/models/api/repository_search.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
array_splice($source_strings_merged, 500);
7272
array_splice($target_strings_merged, 500);
7373

74-
return $json = ShowResults::getRepositorySearchResults(
74+
return ShowResults::getRepositorySearchResults(
7575
$entities_merged,
7676
[$source_strings_merged, $target_strings_merged]
7777
);

app/models/api/suggestions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
return $value;
5656
};
5757

58-
return $json = ShowResults::getSuggestionsResults(
58+
return ShowResults::getSuggestionsResults(
5959
$source_strings_merged,
6060
$target_strings_merged,
6161
$search->getSearchTerms(),

app/models/api/translation_memory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
unset($source_strings, $target_strings);
6262
}
6363

64-
return $json = ShowResults::getTranslationMemoryResults(
64+
return ShowResults::getTranslationMemoryResults(
6565
$output,
6666
$search->getSearchTerms(),
6767
$get_option('max_results'), // Cap results with the ?max_results=number option

app/models/api/versions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?php
22
namespace Transvision;
33

4-
return $json = $request->api_versions;
4+
return $request->api_versions;

0 commit comments

Comments
 (0)