‪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 ‪$postValues = [];
52 
53  public function ‪__construct(ConfigurationManager ‪$configurationManager = null)
54  {
55  $this->configurationManager = ‪$configurationManager ?: GeneralUtility::makeInstance(ConfigurationManager::class);
56  }
57 
64  public function ‪setPostValues(array ‪$postValues)
65  {
66  $this->postValues = ‪$postValues;
67  }
68 
74  public function ‪getIsAvailable()
75  {
76  return $this->‪isAvailable();
77  }
78 
84  public function ‪isActive()
85  {
86  $isActive = true;
87  foreach ($this->configurationValues as $configurationKey => $configurationValue) {
88  try {
89  $currentValue = $this->configurationManager->getConfigurationValueByPath($configurationKey);
90  } catch (MissingArrayPathException $e) {
91  $currentValue = null;
92  }
93  if ($currentValue !== $configurationValue) {
94  $isActive = false;
95  break;
96  }
97  }
98  return $isActive;
99  }
100 
106  public function ‪getIsActive()
107  {
108  return $this->‪isActive();
109  }
110 
116  public function ‪getName()
117  {
118  return ‪$this->name;
119  }
120 
126  public function ‪getPriority()
127  {
128  return ‪$this->priority;
129  }
130 
136  public function ‪getConfigurationValues()
137  {
139  }
140 }
‪TYPO3\CMS\Install\Configuration\AbstractPreset
Definition: AbstractPreset.php:27
‪TYPO3\CMS\Install\Configuration\AbstractPreset\setPostValues
‪mixed setPostValues(array $postValues)
Definition: AbstractPreset.php:59
‪TYPO3\CMS\Install\Configuration\AbstractPreset\$postValues
‪array $postValues
Definition: AbstractPreset.php:46
‪TYPO3\CMS\Install\Configuration\AbstractPreset\getConfigurationValues
‪array getConfigurationValues()
Definition: AbstractPreset.php:131
‪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:79
‪TYPO3\CMS\Install\Configuration\AbstractPreset\$name
‪string $name
Definition: AbstractPreset.php:34
‪TYPO3\CMS\Install\Configuration\AbstractPreset\getPriority
‪int getPriority()
Definition: AbstractPreset.php:121
‪TYPO3\CMS\Install\Configuration\AbstractPreset\__construct
‪__construct(ConfigurationManager $configurationManager=null)
Definition: AbstractPreset.php:48
‪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:111
‪TYPO3\CMS\Install\Configuration\AbstractPreset\getIsActive
‪bool getIsActive()
Definition: AbstractPreset.php:101
‪TYPO3\CMS\Install\Configuration\AbstractPreset\getIsAvailable
‪bool getIsAvailable()
Definition: AbstractPreset.php:69
‪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