ExpressionLanguageProvider::getFunctions()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 0
cts 9
cp 0
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Mathielen\ImportEngineBundle\Expression;
4
5
use Symfony\Component\ExpressionLanguage\ExpressionFunction;
6
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
7
8
class ExpressionLanguageProvider implements ExpressionFunctionProviderInterface
9
{
10
    public function getFunctions()
11
    {
12
        return array(
13
            new ExpressionFunction('date', function ($str) {
14
                return sprintf('(is_string(%1$s) ? date(%1$s) : %1$s)', $str);
15
            }, function (array $arguments, $pattern) {
16
                return date($pattern);
17
            }),
18
        );
19
    }
20
}
21