mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 08:35:00 +00:00
Overrule "constant" and "enum" actions.
This commit is contained in:
@@ -31,7 +31,28 @@ class ActionExpressionLanguageProvider implements ExpressionFunctionProviderInte
|
|||||||
{
|
{
|
||||||
public function getFunctions(): array
|
public function getFunctions(): array
|
||||||
{
|
{
|
||||||
|
|
||||||
return [
|
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('substr'),
|
||||||
ExpressionFunction::fromPhp('strlen'),
|
ExpressionFunction::fromPhp('strlen'),
|
||||||
];
|
];
|
||||||
|
Reference in New Issue
Block a user