-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringExpressionLanguageProvider.php
More file actions
43 lines (39 loc) · 1.76 KB
/
StringExpressionLanguageProvider.php
File metadata and controls
43 lines (39 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
declare(strict_types=1);
namespace Kiboko\Component\StringExpressionLanguage;
use Symfony\Component\ExpressionLanguage\ExpressionFunction;
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
class StringExpressionLanguageProvider implements ExpressionFunctionProviderInterface
{
public function getFunctions(): array
{
return [
ExpressionFunction::fromPhp('sprintf', 'format'),
ExpressionFunction::fromPhp('trim', 'trim'),
new Capitalize('capitalize'),
new ToLowerCase('toLowerCase'),
ExpressionFunction::fromPhp('mb_substr', 'search'),
new ToUpperCase('toUpperCase'),
ExpressionFunction::fromPhp('number_format', 'formatNumber'),
ExpressionFunction::fromPhp('strpos', 'indexOf'),
ExpressionFunction::fromPhp('str_replace', 'replace'),
ExpressionFunction::fromPhp('strip_tags', 'stripHtml'),
ExpressionFunction::fromPhp('json_decode', 'decode'),
ExpressionFunction::fromPhp('preg_replace', 'replaceByExpression'),
ExpressionFunction::fromPhp('preg_match', 'matchExpression'),
new CapitalizeWords('capitalizeWords'),
ExpressionFunction::fromPhp('rtrim', 'removeWhitespaces'),
ExpressionFunction::fromPhp('explode', 'splitIntoArray'),
new Truncate('truncate'),
new FileName('fileName'),
new DateTime('dateTime'),
new FormatDate('formatDate'),
new TruncateFileName('truncateFileName'),
new Now('now'),
new ConvertCharCode('convertCharCode'),
new AsFloat('asFloat'),
new AsInteger('asInteger'),
new AsString('asString'),
];
}
}