Completed
Push — development ( 13a157...98ea90 )
by Thomas
24s
created

OcLegacy/SmartyPlugins/function.translation.php (7 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$params" missing
Loading history...
3
 * Smarty {translation key="snippet.key"} function plugin *
4
 *
5
 * @param $params
0 ignored issues
show
Missing parameter name
Loading history...
Invalid class name "$params"
Loading history...
6
 * @param $smarty
0 ignored issues
show
Missing parameter name
Loading history...
Invalid class name "$smarty"
Loading history...
7
 * @return string
8
 */
9
function smarty_function_translation($params)
0 ignored issues
show
Doc Block params do not match method signature
Loading history...
Type hint "params" missing for
Loading history...
10
{
11
    global $opt;
12
13
    if (!isset($params['key'])) {
14
        return '';
15
    }
16
17
    $translation = AppKernel::Container()->get(OcLegacy\Translation\TranslationService::class);
18
    $translation->setLocale(strtolower($opt['template']['locale']));
19
20
    return $translation->trans($params['key']);
21
}
22