comparison vendor/symfony/dependency-injection/ExpressionLanguageProvider.php @ 12:7a779792577d

Update Drupal core to v8.4.5 (via Composer)
author Chris Cannam
date Fri, 23 Feb 2018 15:52:07 +0000
parents 4c8ae668cc8c
children 129ea1e6d783
comparison
equal deleted inserted replaced
11:bfffd8d7479a 12:7a779792577d
22 * 22 *
23 * @author Fabien Potencier <fabien@symfony.com> 23 * @author Fabien Potencier <fabien@symfony.com>
24 */ 24 */
25 class ExpressionLanguageProvider implements ExpressionFunctionProviderInterface 25 class ExpressionLanguageProvider implements ExpressionFunctionProviderInterface
26 { 26 {
27 private $serviceCompiler;
28
29 public function __construct(callable $serviceCompiler = null)
30 {
31 $this->serviceCompiler = $serviceCompiler;
32 }
33
27 public function getFunctions() 34 public function getFunctions()
28 { 35 {
29 return array( 36 return array(
30 new ExpressionFunction('service', function ($arg) { 37 new ExpressionFunction('service', $this->serviceCompiler ?: function ($arg) {
31 return sprintf('$this->get(%s)', $arg); 38 return sprintf('$this->get(%s)', $arg);
32 }, function (array $variables, $value) { 39 }, function (array $variables, $value) {
33 return $variables['container']->get($value); 40 return $variables['container']->get($value);
34 }), 41 }),
35 42