‪TYPO3CMS  10.4
AbstractPreset.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
18 use TYPO3\CMS\Core\Configuration\ConfigurationManager;
21 
26 abstract class ‪AbstractPreset implements ‪PresetInterface
27 {
31  protected ‪$configurationManager;
32 
36  protected ‪$name = '';
37 
41  protected ‪$priority = 50;
42 
46  protected ‪$configurationValues = [];
47 
51  protected ‪$postValues = [];
52 
56  public function ‪__construct(ConfigurationManager ‪$configurationManager = null)
57  {
58  $this->configurationManager = ‪$configurationManager ?: GeneralUtility::makeInstance(ConfigurationManager::class);
59  }
60 
67  public function ‪setPostValues(array ‪$postValues)
68  {
69  $this->postValues = ‪$postValues;
70  }
71 
77  public function ‪getIsAvailable()
78  {
79  return $this->‪isAvailable();
80  }
81 
87  public function ‪isActive()
88  {
89  $isActive = true;
90  foreach ($this->configurationValues as $configurationKey => $configurationValue) {
91  try {
92  $currentValue = $this->configurationManager->getConfigurationValueByPath($configurationKey);
93  } catch (MissingArrayPathException $e) {
94  $currentValue = null;
95  }
96  if ($currentValue !== $configurationValue) {
97  $isActive = false;
98  break;
99  }
100  }
101  return $isActive;
102  }
103 
109  public function ‪getIsActive()
110  {
111  return $this->‪isActive();
112  }
113 
119  public function ‪getName()
120  {
121  return ‪$this->name;
122  }
123 
129  public function ‪getPriority()
130  {
131  return ‪$this->priority;
132  }
133 
139  public function ‪getConfigurationValues()
140  {
142  }
143 }
‪TYPO3\CMS\Install\Configuration\AbstractPreset
Definition: AbstractPreset.php:27
‪TYPO3\CMS\Install\Configuration\AbstractPreset\setPostValues
‪mixed setPostValues(array $postValues)
Definition: AbstractPreset.php:62
‪TYPO3\CMS\Install\Configuration\AbstractPreset\$postValues
‪array $postValues
Definition: AbstractPreset.php:46
‪TYPO3\CMS\Install\Configuration\AbstractPreset\getConfigurationValues
‪array getConfigurationValues()
Definition: AbstractPreset.php:134
‪TYPO3\CMS\Core\Utility\Exception\MissingArrayPathException
Definition: MissingArrayPathException.php:28
‪TYPO3\CMS\Install\Configuration\AbstractPreset\$configurationValues
‪array $configurationValues
Definition: AbstractPreset.php:42
‪TYPO3\CMS\Install\Configuration\AbstractPreset\$priority
‪int $priority
Definition: AbstractPreset.php:38
‪TYPO3\CMS\Install\Configuration\PresetInterface
Definition: PresetInterface.php:25
‪TYPO3\CMS\Install\Configuration\AbstractPreset\isActive
‪bool isActive()
Definition: AbstractPreset.php:82
‪TYPO3\CMS\Install\Configuration\AbstractPreset\$name
‪string $name
Definition: AbstractPreset.php:34
‪TYPO3\CMS\Install\Configuration\AbstractPreset\getPriority
‪int getPriority()
Definition: AbstractPreset.php:124
‪TYPO3\CMS\Install\Configuration\AbstractPreset\__construct
‪__construct(ConfigurationManager $configurationManager=null)
Definition: AbstractPreset.php:51
‪TYPO3\CMS\Install\Configuration
Definition: AbstractCustomPreset.php:16
‪TYPO3\CMS\Install\Configuration\PresetInterface\isAvailable
‪bool isAvailable()
‪TYPO3\CMS\Install\Configuration\AbstractPreset\getName
‪string getName()
Definition: AbstractPreset.php:114
‪TYPO3\CMS\Install\Configuration\AbstractPreset\getIsActive
‪bool getIsActive()
Definition: AbstractPreset.php:104
‪TYPO3\CMS\Install\Configuration\AbstractPreset\getIsAvailable
‪bool getIsAvailable()
Definition: AbstractPreset.php:72
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46
‪TYPO3\CMS\Install\Configuration\AbstractPreset\$configurationManager
‪TYPO3 CMS Core Configuration ConfigurationManager $configurationManager
Definition: AbstractPreset.php:30