1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?php
- namespace Symfony\Component\HttpKernel\CacheWarmer;
- class CacheWarmerAggregate implements CacheWarmerInterface
- {
- protected $warmers = array();
- protected $optionalsEnabled = false;
- public function __construct(array $warmers = array())
- {
- foreach ($warmers as $warmer) {
- $this->add($warmer);
- }
- }
- public function enableOptionalWarmers()
- {
- $this->optionalsEnabled = true;
- }
-
- public function warmUp($cacheDir)
- {
- foreach ($this->warmers as $warmer) {
- if (!$this->optionalsEnabled && $warmer->isOptional()) {
- continue;
- }
- $warmer->warmUp($cacheDir);
- }
- }
-
- public function isOptional()
- {
- return false;
- }
- public function setWarmers(array $warmers)
- {
- $this->warmers = array();
- foreach ($warmers as $warmer) {
- $this->add($warmer);
- }
- }
- public function add(CacheWarmerInterface $warmer)
- {
- $this->warmers[] = $warmer;
- }
- }
|