Commit 824e8e1e authored by Fabio Montefuscolo's avatar Fabio Montefuscolo

[FIX] Unnecessary complexity for loop on translation service

parent 20e0ed8d
Pipeline #49751972 failed with stages
in 25 minutes and 4 seconds
......@@ -169,13 +169,18 @@ class Services_Language_Controller
$from = $input->asArray('from');
$to = $input->asArray('to');
if (count($from) > 1) {
$isValid = is_array($from)
&& is_array($to)
&& count($from) > 0
&& count($from) === count($to);
if ($isValid) {
$data = array();
//prepare data
foreach ($from as $fromKey => $source) {
foreach ($to as $toKey => $translation) {
if ($fromKey === $toKey) {
$data[$source] = $translation;
}
foreach ($from as $index => $source) {
if (! empty($to[$index]) && ! empty($source)) {
$data[ $source ] = $to[ $index ];
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment