Commit 50cb083b authored by Stefan Froemken's avatar Stefan Froemken

Move extension configuration into own class

parent 79a4bb95
Pipeline #2239 passed with stages
in 1 minute and 25 seconds
<?php
namespace T3o\Ter\Configuration;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Core\SingletonInterface;
/**
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
*/
class ExtConf implements SingletonInterface
{
/**
* repository directory
*
* @var string
*/
protected $repositoryDir = '';
/**
* constructor of this class
* This method reads the global configuration and calls the setter methods.
*/
public function __construct()
{
// get global configuration
$extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['ter']);
if (is_array($extConf) && count($extConf)) {
// call setter method foreach configuration entry
foreach ($extConf as $key => $value) {
$methodName = 'set' . ucfirst($key);
if (method_exists($this, $methodName)) {
$this->$methodName($value);
}
}
}
}
/**
* Returns the repositoryDir
*
* @return string $repositoryDir
*/
public function getRepositoryDir(): string
{
return $this->repositoryDir;
}
/**
* Sets the repositoryDir
*
* @param string $repositoryDir
*
* @return void
*/
public function setRepositoryDir(string $repositoryDir)
{
$this->repositoryDir = rtrim($repositoryDir, '/') . '/';
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment