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