ArgumentInterpreter.php 871 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\App\Arguments;
  7. use Magento\Framework\Data\Argument\Interpreter\Constant;
  8. use Magento\Framework\Data\Argument\InterpreterInterface;
  9. /**
  10. * Interpreter that returns value of an application argument, retrieving its name from a constant
  11. */
  12. class ArgumentInterpreter implements InterpreterInterface
  13. {
  14. /**
  15. * @var Constant
  16. */
  17. private $constInterpreter;
  18. /**
  19. * @param Constant $constInterpreter
  20. */
  21. public function __construct(Constant $constInterpreter)
  22. {
  23. $this->constInterpreter = $constInterpreter;
  24. }
  25. /**
  26. * {@inheritdoc}
  27. * @return mixed
  28. */
  29. public function evaluate(array $data)
  30. {
  31. return ['argument' => $this->constInterpreter->evaluate($data)];
  32. }
  33. }