Compare commits

..

No commits in common. "10632e9f673fbc4e47aa0ca6379f8172ef3bca3d" and "cfc2f5d9af167165fe37285f8e0203c73b531e8b" have entirely different histories.

3 changed files with 18 additions and 9 deletions

View File

@ -39,12 +39,12 @@ class LanguageExtension implements Extension {
$context->pushFunction("lang", [ $this, 'absoluteLang' ]);
}
public function relativeLang(string $key, array $variables = []) #: array|string
public function relativeLang(string $key, array $variables = []) : string
{
return $this->languageHandler->languageFromKey("{$this->currentLanguage}.{$key}", $variables);
}
public function absoluteLang(string $key, array $variables = []) #: array|string
public function absoluteLang(string $key, array $variables = []) : string
{
return $this->languageHandler->languageFromKey($key, $variables);
}

View File

@ -4,5 +4,5 @@ namespace Picea\Extension;
interface LanguageHandler
{
public function languageFromKey(string $key, array $variables = []); #: array|string;
public function languageFromKey(string $key, array $variables = []) : string;
}

View File

@ -173,14 +173,23 @@ class UrlExtension implements Extension {
$value = $arguments[ $item[1] ];
}
else if ( isset($default) ) {
$value = ""; # $default;
$value = $default;
}
else {
$variable = $item[1];
}
$search[ $item[0] ] = $value;
# 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;
unset($arguments[ $item[1] ]);
}