Security update for Core, with self-updated composer
[yaffs-website] / web / core / lib / Drupal / Core / Config / ConfigCrudEvent.php
1 <?php
2
3 namespace Drupal\Core\Config;
4
5 use Symfony\Component\EventDispatcher\Event;
6
7 /**
8  * Wraps a configuration event for event listeners.
9  */
10 class ConfigCrudEvent extends Event {
11
12   /**
13    * Configuration object.
14    *
15    * @var \Drupal\Core\Config\Config
16    */
17   protected $config;
18
19   /**
20    * Constructs a configuration event object.
21    *
22    * @param \Drupal\Core\Config\Config $config
23    *   Configuration object.
24    */
25   public function __construct(Config $config) {
26     $this->config = $config;
27   }
28
29   /**
30    * Gets configuration object.
31    *
32    * @return \Drupal\Core\Config\Config
33    *   The configuration object that caused the event to fire.
34    */
35   public function getConfig() {
36     return $this->config;
37   }
38
39   /**
40    * Checks to see if the provided configuration key's value has changed.
41    *
42    * @param string $key
43    *   The configuration key to check if it has changed.
44    *
45    * @return bool
46    */
47   public function isChanged($key) {
48     return $this->config->get($key) !== $this->config->getOriginal($key);
49   }
50
51 }