4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\HttpKernel\CacheClearer;
17 * @author Dustin Dobervich <ddobervich@gmail.com>
19 * @final since version 3.4
21 class ChainCacheClearer implements CacheClearerInterface
26 * Constructs a new instance of ChainCacheClearer.
28 * @param array $clearers The initial clearers
30 public function __construct($clearers = array())
32 $this->clearers = $clearers;
38 public function clear($cacheDir)
40 foreach ($this->clearers as $clearer) {
41 $clearer->clear($cacheDir);
46 * Adds a cache clearer to the aggregate.
48 * @deprecated since version 3.4, to be removed in 4.0, inject the list of clearers as a constructor argument instead.
50 public function add(CacheClearerInterface $clearer)
52 @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0, inject the list of clearers as a constructor argument instead.', __METHOD__), E_USER_DEPRECATED);
54 $this->clearers[] = $clearer;