ArrayParserCache.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\ExpressionLanguage\ParserCache;
  11. @trigger_error('The '.__NAMESPACE__.'\ArrayParserCache class is deprecated since Symfony 3.2 and will be removed in 4.0. Use the Symfony\Component\Cache\Adapter\ArrayAdapter class instead.', E_USER_DEPRECATED);
  12. use Symfony\Component\ExpressionLanguage\ParsedExpression;
  13. /**
  14. * @author Adrien Brault <adrien.brault@gmail.com>
  15. *
  16. * @deprecated ArrayParserCache class is deprecated since version 3.2 and will be removed in 4.0. Use the Symfony\Component\Cache\Adapter\ArrayAdapter class instead.
  17. */
  18. class ArrayParserCache implements ParserCacheInterface
  19. {
  20. private $cache = [];
  21. /**
  22. * {@inheritdoc}
  23. */
  24. public function fetch($key)
  25. {
  26. return isset($this->cache[$key]) ? $this->cache[$key] : null;
  27. }
  28. /**
  29. * {@inheritdoc}
  30. */
  31. public function save($key, ParsedExpression $expression)
  32. {
  33. $this->cache[$key] = $expression;
  34. }
  35. }