Permalink
Browse files

bug #4637 fixed StringExpressionLanguageProvider code example #4636 (…

…danieleorler)

This PR was squashed before being merged into the 2.6 branch (closes #4637).

Discussion
----------

fixed StringExpressionLanguageProvider code example #4636

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | 2.6
| Fixed tickets | #4636

Commits
-------

33e0a7f fixed StringExpressionLanguageProvider code example #4636
  • Loading branch information...
wouterj committed Dec 13, 2014
2 parents fc3e50b + 33e0a7f commit a2ea256083cf54c1b712a489d17df1fefe98deb9
Showing with 14 additions and 11 deletions.
  1. +14 −11 components/expression_language/extending.rst
@@ -77,17 +77,20 @@ register.
class StringExpressionLanguageProvider implements ExpressionFunctionProviderInterface
{
return array(
new ExpressionFunction('lowercase', function ($str) {
return sprintf('(is_string(%1$s) ? strtolower(%1$s) : %1$s)', $str);
}, function ($arguments, $str) {
if (!is_string($str)) {
return $str;
}
return strtolower($str);
});
);
public function getFunctions()
{
return array(
new ExpressionFunction('lowercase', function ($str) {
return sprintf('(is_string(%1$s) ? strtolower(%1$s) : %1$s)', $str);
}, function ($arguments, $str) {
if (!is_string($str)) {
return $str;
}
return strtolower($str);
}),
);
}
}
You can register providers using

0 comments on commit a2ea256

Please sign in to comment.