comparison vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 4c8ae668cc8c
children 129ea1e6d783
comparison
equal deleted inserted replaced
13:5fb285c0d0e3 14:1fec387a4317
13 13
14 /** 14 /**
15 * Aggregates several cache warmers into a single one. 15 * Aggregates several cache warmers into a single one.
16 * 16 *
17 * @author Fabien Potencier <fabien@symfony.com> 17 * @author Fabien Potencier <fabien@symfony.com>
18 *
19 * @final since version 3.4
18 */ 20 */
19 class CacheWarmerAggregate implements CacheWarmerInterface 21 class CacheWarmerAggregate implements CacheWarmerInterface
20 { 22 {
21 protected $warmers = array(); 23 protected $warmers = array();
22 protected $optionalsEnabled = false; 24 protected $optionalsEnabled = false;
25 private $triggerDeprecation = false;
23 26
24 public function __construct(array $warmers = array()) 27 public function __construct($warmers = array())
25 { 28 {
26 foreach ($warmers as $warmer) { 29 foreach ($warmers as $warmer) {
27 $this->add($warmer); 30 $this->add($warmer);
28 } 31 }
32 $this->triggerDeprecation = true;
29 } 33 }
30 34
31 public function enableOptionalWarmers() 35 public function enableOptionalWarmers()
32 { 36 {
33 $this->optionalsEnabled = true; 37 $this->optionalsEnabled = true;
57 public function isOptional() 61 public function isOptional()
58 { 62 {
59 return false; 63 return false;
60 } 64 }
61 65
66 /**
67 * @deprecated since version 3.4, to be removed in 4.0, inject the list of clearers as a constructor argument instead.
68 */
62 public function setWarmers(array $warmers) 69 public function setWarmers(array $warmers)
63 { 70 {
71 @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);
72
64 $this->warmers = array(); 73 $this->warmers = array();
65 foreach ($warmers as $warmer) { 74 foreach ($warmers as $warmer) {
66 $this->add($warmer); 75 $this->add($warmer);
67 } 76 }
68 } 77 }
69 78
79 /**
80 * @deprecated since version 3.4, to be removed in 4.0, inject the list of clearers as a constructor argument instead.
81 */
70 public function add(CacheWarmerInterface $warmer) 82 public function add(CacheWarmerInterface $warmer)
71 { 83 {
84 if ($this->triggerDeprecation) {
85 @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);
86 }
87
72 $this->warmers[] = $warmer; 88 $this->warmers[] = $warmer;
73 } 89 }
74 } 90 }