Example #1
0
 /**
  * Settings lazy loading.
  *
  * @param SettingsOwnerInterface|null $owner
  *
  * @return SettingsManager
  */
 private function loadSettings(SettingsOwnerInterface $owner = null)
 {
     // Global settings
     if ($this->globalSettings === null) {
         $this->globalSettings = $this->getSettingsFromRepository();
     }
     // User settings
     if ($owner !== null && ($this->ownerSettings === null || !array_key_exists($owner->getSettingIdentifier(), $this->ownerSettings))) {
         $this->ownerSettings[$owner->getSettingIdentifier()] = $this->getSettingsFromRepository($owner);
     }
     return $this;
 }
 /**
  * @param string $key
  * @param SettingsOwnerInterface $owner
  *
  * @return string
  */
 protected function getCacheKey($key, SettingsOwnerInterface $owner = null)
 {
     return sprintf(self::PREFIX, $owner ? $owner->getSettingIdentifier() : '', $key);
 }