ArrayParserCache.php 812 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. use Symfony\Component\ExpressionLanguage\ParsedExpression;
  12. /**
  13. * @author Adrien Brault <adrien.brault@gmail.com>
  14. */
  15. class ArrayParserCache implements ParserCacheInterface
  16. {
  17. private $cache = array();
  18. /**
  19. * {@inheritdoc}
  20. */
  21. public function fetch($key)
  22. {
  23. return isset($this->cache[$key]) ? $this->cache[$key] : null;
  24. }
  25. /**
  26. * {@inheritdoc}
  27. */
  28. public function save($key, ParsedExpression $expression)
  29. {
  30. $this->cache[$key] = $expression;
  31. }
  32. }