Compare commits
3 Commits
cfc2f5d9af
...
10632e9f67
Author | SHA1 | Date | |
---|---|---|---|
10632e9f67 | |||
8368551fa7 | |||
2f31684092 |
@ -39,12 +39,12 @@ class LanguageExtension implements Extension {
|
|||||||
$context->pushFunction("lang", [ $this, 'absoluteLang' ]);
|
$context->pushFunction("lang", [ $this, 'absoluteLang' ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function relativeLang(string $key, array $variables = []) : string
|
public function relativeLang(string $key, array $variables = []) #: array|string
|
||||||
{
|
{
|
||||||
return $this->languageHandler->languageFromKey("{$this->currentLanguage}.{$key}", $variables);
|
return $this->languageHandler->languageFromKey("{$this->currentLanguage}.{$key}", $variables);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function absoluteLang(string $key, array $variables = []) : string
|
public function absoluteLang(string $key, array $variables = []) #: array|string
|
||||||
{
|
{
|
||||||
return $this->languageHandler->languageFromKey($key, $variables);
|
return $this->languageHandler->languageFromKey($key, $variables);
|
||||||
}
|
}
|
||||||
|
@ -4,5 +4,5 @@ namespace Picea\Extension;
|
|||||||
|
|
||||||
interface LanguageHandler
|
interface LanguageHandler
|
||||||
{
|
{
|
||||||
public function languageFromKey(string $key, array $variables = []) : string;
|
public function languageFromKey(string $key, array $variables = []); #: array|string;
|
||||||
}
|
}
|
||||||
|
@ -173,23 +173,14 @@ class UrlExtension implements Extension {
|
|||||||
$value = $arguments[ $item[1] ];
|
$value = $arguments[ $item[1] ];
|
||||||
}
|
}
|
||||||
else if ( isset($default) ) {
|
else if ( isset($default) ) {
|
||||||
$value = $default;
|
$value = ""; # $default;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$variable = $item[1];
|
$variable = $item[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
# if ( array_key_exists($variable, $arguments) ) {
|
|
||||||
# $value = $arguments[ $item[1] ];
|
|
||||||
# }
|
|
||||||
# else if ( isset($default) ) {
|
|
||||||
# $value = $default;
|
|
||||||
# }
|
|
||||||
# else {
|
|
||||||
# throw new \InvalidArgumentException("Argument `$variable` is missing within required route parameter(s)");
|
|
||||||
# }
|
|
||||||
|
|
||||||
$search[ $item[0] ] = $value;
|
$search[ $item[0] ] = $value;
|
||||||
|
|
||||||
unset($arguments[ $item[1] ]);
|
unset($arguments[ $item[1] ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user