2026-03-12 08:41:15 +01:00
|
|
|
<?php
|
|
|
|
|
|
2026-03-13 03:55:47 +01:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2026-03-12 08:41:15 +01:00
|
|
|
namespace FireflyIII\TransactionRules\Engine;
|
|
|
|
|
|
|
|
|
|
use Symfony\Component\ExpressionLanguage\ExpressionFunction;
|
|
|
|
|
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
|
|
|
|
|
|
|
|
|
|
class CustomExpressionLanguage extends ExpressionLanguage
|
|
|
|
|
{
|
|
|
|
|
protected function registerFunctions(): void
|
|
|
|
|
{
|
2026-03-13 03:55:47 +01:00
|
|
|
$basicPhpFunctions = ['min', 'max', 'substr', 'strlen', 'strpos'];
|
2026-03-12 08:41:15 +01:00
|
|
|
foreach ($basicPhpFunctions as $function) {
|
|
|
|
|
$this->addFunction(ExpressionFunction::fromPhp($function));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|