‪TYPO3CMS  ‪main
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 ‪$readonlyConfigurationValues = [];
52 
56  protected ‪$postValues = [];
57 
58  public function ‪__construct(ConfigurationManager ‪$configurationManager = null)
59  {
60  $this->configurationManager = ‪$configurationManager ?: GeneralUtility::makeInstance(ConfigurationManager::class);
61  }
62 
69  public function ‪setPostValues(array ‪$postValues)
70  {
71  $this->postValues = ‪$postValues;
72  }
73 
79  public function ‪getIsAvailable()
80  {
81  return $this->‪isAvailable();
82  }
83 
89  public function ‪isActive()
90  {
91  $isActive = true;
92  foreach ($this->configurationValues as $configurationKey => $configurationValue) {
93  try {
94  $currentValue = $this->configurationManager->getConfigurationValueByPath($configurationKey);
95  } catch (‪MissingArrayPathException $e) {
96  $currentValue = null;
97  }
98  if ($currentValue !== $configurationValue) {
99  $isActive = false;
100  break;
101  }
102  }
103  return $isActive;
104  }
105 
111  public function ‪getIsActive()
112  {
113  return $this->‪isActive();
114  }
115 
121  public function ‪getName()
122  {
123  return ‪$this->name;
124  }
125 
131  public function ‪getPriority()
132  {
133  return ‪$this->priority;
134  }
135 
141  public function ‪getConfigurationValues()
142  {
144  }
145 }
‪TYPO3\CMS\Install\Configuration\AbstractPreset
Definition: AbstractPreset.php:27
‪TYPO3\CMS\Install\Configuration\AbstractPreset\setPostValues
‪mixed setPostValues(array $postValues)
Definition: AbstractPreset.php:63
‪TYPO3\CMS\Install\Configuration\AbstractPreset\$postValues
‪array $postValues
Definition: AbstractPreset.php:50
‪TYPO3\CMS\Install\Configuration\AbstractPreset\getConfigurationValues
‪array getConfigurationValues()
Definition: AbstractPreset.php:135
‪TYPO3\CMS\Core\Utility\Exception\MissingArrayPathException
Definition: MissingArrayPathException.php:27
‪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:83
‪TYPO3\CMS\Install\Configuration\AbstractPreset\$name
‪string $name
Definition: AbstractPreset.php:34
‪TYPO3\CMS\Install\Configuration\AbstractPreset\$readonlyConfigurationValues
‪array $readonlyConfigurationValues
Definition: AbstractPreset.php:46
‪TYPO3\CMS\Install\Configuration\AbstractPreset\getPriority
‪int getPriority()
Definition: AbstractPreset.php:125
‪TYPO3\CMS\Install\Configuration\AbstractPreset\__construct
‪__construct(ConfigurationManager $configurationManager=null)
Definition: AbstractPreset.php:52
‪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:115
‪TYPO3\CMS\Install\Configuration\AbstractPreset\getIsActive
‪bool getIsActive()
Definition: AbstractPreset.php:105
‪TYPO3\CMS\Install\Configuration\AbstractPreset\getIsAvailable
‪bool getIsAvailable()
Definition: AbstractPreset.php:73
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:52
‪TYPO3\CMS\Install\Configuration\AbstractPreset\$configurationManager
‪TYPO3 CMS Core Configuration ConfigurationManager $configurationManager
Definition: AbstractPreset.php:30