‪TYPO3CMS  ‪main
Settings.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
23 readonly class ‪Settings implements ‪SettingsInterface
24 {
25  public function ‪__construct(
26  protected array $settings,
27  ) {}
28 
29  public function ‪has(string ‪$identifier): bool
30  {
31  return isset($this->settings[‪$identifier]);
32  }
33 
34  public function get(string ‪$identifier): mixed
35  {
36  if (!$this->‪has(‪$identifier)) {
37  throw new \InvalidArgumentException('Setting does not exist', 1709555772);
38  }
39  return $this->settings[‪$identifier];
40  }
41 
42  public function ‪getIdentifiers(): array
43  {
44  return array_keys($this->settings);
45  }
46 
47  public static function ‪__set_state(array $state): self
48  {
49  return new self(...$state);
50  }
51 }
‪TYPO3\CMS\Core\Settings\Settings\getIdentifiers
‪getIdentifiers()
Definition: Settings.php:42
‪TYPO3\CMS\Core\Settings\Settings\__construct
‪__construct(protected array $settings,)
Definition: Settings.php:25
‪TYPO3\CMS\Core\Settings\SettingsInterface
Definition: SettingsInterface.php:24
‪TYPO3\CMS\Core\Settings\Settings\has
‪has(string $identifier)
Definition: Settings.php:29
‪TYPO3\CMS\Core\Settings
Definition: SettingDefinition.php:18
‪TYPO3\CMS\Core\Settings\Settings
Definition: Settings.php:24
‪TYPO3\CMS\Core\Settings\Settings\__set_state
‪static __set_state(array $state)
Definition: Settings.php:47
‪TYPO3\CMS\Webhooks\Message\$identifier
‪identifier readonly string $identifier
Definition: FileAddedMessage.php:37