mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Overrule "constant" and "enum" actions.
This commit is contained in:
parent
5746ac3247
commit
67b16cc070
@ -31,7 +31,28 @@ class ActionExpressionLanguageProvider implements ExpressionFunctionProviderInte
|
||||
{
|
||||
public function getFunctions(): array
|
||||
{
|
||||
|
||||
return [
|
||||
|
||||
new ExpressionFunction('constant', function ($str): string {
|
||||
return sprintf('(is_string(%1$s) ? strtolower(%1$s) : %1$s)', $str . '!');
|
||||
}, function ($arguments, $str): string {
|
||||
if (!is_string($str)) {
|
||||
return $str;
|
||||
}
|
||||
|
||||
return strtolower($str . '!');
|
||||
}),
|
||||
new ExpressionFunction('enum', function ($str): string {
|
||||
return sprintf('(is_string(%1$s) ? strtolower(%1$s) : %1$s)', $str . '?');
|
||||
}, function ($arguments, $str): string {
|
||||
if (!is_string($str)) {
|
||||
return $str;
|
||||
}
|
||||
|
||||
return strtolower($str) . '?';
|
||||
}),
|
||||
|
||||
ExpressionFunction::fromPhp('substr'),
|
||||
ExpressionFunction::fromPhp('strlen'),
|
||||
];
|
||||
|
Loading…
Reference in New Issue
Block a user