@@ -51,6 +51,8 @@ an ``arguments`` variable as their first argument, which is equal to the
51
51
second argument to ``evaluate() `` or ``compile() `` (e.g. the "values" when
52
52
evaluating or the "names" if compiling).
53
53
54
+ .. _components-expression-language-provider :
55
+
54
56
Using Expression Providers
55
57
--------------------------
56
58
@@ -63,9 +65,10 @@ creating a class that implements
63
65
:class: `Symfony\\ Component\\ ExpressionLanguage\\ ExpressionFunctionProviderInterface `.
64
66
65
67
This interface requires one method:
66
- :method: `Symfony\\ Component\\ ExpressionLanguage\\ ExpressionFunctionProviderInterface::getFunctions `.
67
- This method returns an array of expression functions (instances of
68
- :class: `Symfony\\ Component\\ ExpressionLanguage\\ ExpressionFunction `) to register.
68
+ :method: `Symfony\\ Component\\ ExpressionLanguage\\ ExpressionFunctionProviderInterface::getFunctions `,
69
+ which returns an array of expression functions (instances of
70
+ :class: `Symfony\\ Component\\ ExpressionLanguage\\ ExpressionFunction `) to
71
+ register.
69
72
70
73
.. code-block :: php
71
74
@@ -94,8 +97,12 @@ or by using the second argument of the constructor::
94
97
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
95
98
96
99
// using the constructor
97
- $language = new ExpressionLanguage(null, array(...));
100
+ $language = new ExpressionLanguage(null, array(
101
+ new StringExpressionLanguageProvider(),
102
+ // ...
103
+ ));
98
104
105
+ // using registerProvider()
99
106
$language->registerProvider(new StringExpressionLanguageProvider());
100
107
101
108
.. tip ::
@@ -111,7 +118,7 @@ or by using the second argument of the constructor::
111
118
public function __construct(ParserCacheInterface $parser = null, array $providers = array())
112
119
{
113
120
// prepend the default provider to let users override it easily
114
- array_unshift($providers, new MyExpressionLanguageProvider ());
121
+ array_unshift($providers, new StringExpressionLanguageProvider ());
115
122
116
123
parent::__construct($parser, $providers);
117
124
}
0 commit comments