@@ -51,6 +51,8 @@ an ``arguments`` variable as their first argument, which is equal to the
5151second argument to ``evaluate() `` or ``compile() `` (e.g. the "values" when
5252evaluating or the "names" if compiling).
5353
54+ .. _components-expression-language-provider :
55+
5456Using Expression Providers
5557--------------------------
5658
@@ -63,9 +65,10 @@ creating a class that implements
6365:class: `Symfony\\ Component\\ ExpressionLanguage\\ ExpressionFunctionProviderInterface `.
6466
6567This 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.
6972
7073.. code-block :: php
7174
@@ -94,8 +97,12 @@ or by using the second argument of the constructor::
9497 use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
9598
9699 // using the constructor
97- $language = new ExpressionLanguage(null, array(...));
100+ $language = new ExpressionLanguage(null, array(
101+ new StringExpressionLanguageProvider(),
102+ // ...
103+ ));
98104
105+ // using registerProvider()
99106 $language->registerProvider(new StringExpressionLanguageProvider());
100107
101108.. tip ::
@@ -111,7 +118,7 @@ or by using the second argument of the constructor::
111118 public function __construct(ParserCacheInterface $parser = null, array $providers = array())
112119 {
113120 // prepend the default provider to let users override it easily
114- array_unshift($providers, new MyExpressionLanguageProvider ());
121+ array_unshift($providers, new StringExpressionLanguageProvider ());
115122
116123 parent::__construct($parser, $providers);
117124 }
0 commit comments