Drupal investigation

ChainCacheClearer.php 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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\HttpKernel\CacheClearer;
  11. /**
  12. * ChainCacheClearer.
  13. *
  14. * @author Dustin Dobervich <ddobervich@gmail.com>
  15. */
  16. class ChainCacheClearer implements CacheClearerInterface
  17. {
  18. /**
  19. * @var array
  20. */
  21. protected $clearers;
  22. /**
  23. * Constructs a new instance of ChainCacheClearer.
  24. *
  25. * @param array $clearers The initial clearers
  26. */
  27. public function __construct(array $clearers = array())
  28. {
  29. $this->clearers = $clearers;
  30. }
  31. /**
  32. * {@inheritdoc}
  33. */
  34. public function clear($cacheDir)
  35. {
  36. foreach ($this->clearers as $clearer) {
  37. $clearer->clear($cacheDir);
  38. }
  39. }
  40. /**
  41. * Adds a cache clearer to the aggregate.
  42. *
  43. * @param CacheClearerInterface $clearer
  44. */
  45. public function add(CacheClearerInterface $clearer)
  46. {
  47. $this->clearers[] = $clearer;
  48. }
  49. }