‪TYPO3CMS  11.5
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 
61  public function ‪__construct(ConfigurationManager ‪$configurationManager = null)
62  {
63  $this->configurationManager = ‪$configurationManager ?: GeneralUtility::makeInstance(ConfigurationManager::class);
64  }
65 
72  public function ‪setPostValues(array ‪$postValues)
73  {
74  $this->postValues = ‪$postValues;
75  }
76 
82  public function ‪getIsAvailable()
83  {
84  return $this->‪isAvailable();
85  }
86 
92  public function ‪isActive()
93  {
94  $isActive = true;
95  foreach ($this->configurationValues as $configurationKey => $configurationValue) {
96  try {
97  $currentValue = $this->configurationManager->getConfigurationValueByPath($configurationKey);
98  } catch (‪MissingArrayPathException $e) {
99  $currentValue = null;
100  }
101  if ($currentValue !== $configurationValue) {
102  $isActive = false;
103  break;
104  }
105  }
106  return $isActive;
107  }
108 
114  public function ‪getIsActive()
115  {
116  return $this->‪isActive();
117  }
118 
124  public function ‪getName()
125  {
126  return ‪$this->name;
127  }
128 
134  public function ‪getPriority()
135  {
136  return ‪$this->priority;
137  }
138 
144  public function ‪getConfigurationValues()
145  {
147  }
148 }
‪TYPO3\CMS\Install\Configuration\AbstractPreset
Definition: AbstractPreset.php:27
‪TYPO3\CMS\Install\Configuration\AbstractPreset\setPostValues
‪mixed setPostValues(array $postValues)
Definition: AbstractPreset.php:66
‪TYPO3\CMS\Install\Configuration\AbstractPreset\$postValues
‪array $postValues
Definition: AbstractPreset.php:50
‪TYPO3\CMS\Install\Configuration\AbstractPreset\getConfigurationValues
‪array getConfigurationValues()
Definition: AbstractPreset.php:138
‪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:86
‪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:128
‪TYPO3\CMS\Install\Configuration\AbstractPreset\__construct
‪__construct(ConfigurationManager $configurationManager=null)
Definition: AbstractPreset.php:55
‪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:118
‪TYPO3\CMS\Install\Configuration\AbstractPreset\getIsActive
‪bool getIsActive()
Definition: AbstractPreset.php:108
‪TYPO3\CMS\Install\Configuration\AbstractPreset\getIsAvailable
‪bool getIsAvailable()
Definition: AbstractPreset.php:76
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:50
‪TYPO3\CMS\Install\Configuration\AbstractPreset\$configurationManager
‪TYPO3 CMS Core Configuration ConfigurationManager $configurationManager
Definition: AbstractPreset.php:30