mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-18 15:39:50 +00:00
Fix a few small bugs and rearrange code.
This commit is contained in:
@@ -32,24 +32,34 @@ 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;
|
||||
}
|
||||
new ExpressionFunction(
|
||||
'constant',
|
||||
function ($str): string {
|
||||
return sprintf('(is_string(%1$s) ? strtolower(%1$s) : %1$s)', $str.'!');
|
||||
},
|
||||
// @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
function ($arguments, $str): string {
|
||||
if (!is_string($str)) {
|
||||
return (string) $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.'!');
|
||||
}
|
||||
),
|
||||
new ExpressionFunction(
|
||||
'enum',
|
||||
function ($str): string {
|
||||
return sprintf('(is_string(%1$s) ? strtolower(%1$s) : %1$s)', $str.'?');
|
||||
},
|
||||
// @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
function ($arguments, $str): string {
|
||||
if (!is_string($str)) {
|
||||
return (string) $str;
|
||||
}
|
||||
|
||||
return strtolower($str).'?';
|
||||
}),
|
||||
return strtolower($str).'?';
|
||||
}
|
||||
),
|
||||
|
||||
ExpressionFunction::fromPhp('substr'),
|
||||
ExpressionFunction::fromPhp('strlen'),
|
||||
|
||||
Reference in New Issue
Block a user