2 namespace TYPO3\CMS\Composer\Plugin;
16 'backend-dir' =>
'{$web-dir}/typo3',
17 'config-dir' =>
'{$web-dir}/typo3conf',
18 'temporary-dir' =>
'{$web-dir}/typo3temp',
19 'cache-dir' =>
'{$temporary-dir}/Cache',
20 'cms-package-dir' =>
'typo3_src',
21 'composer-mode' =>
true,
41 $this->config = static::$defaultConfig;
51 if (!empty($config[
'typo3/cms']) && is_array($config[
'typo3/cms'])) {
52 foreach ($config[
'typo3/cms'] as $key => $val) {
53 $this->config[$key] = $val;
66 public function get($key, $flags = 0) {
70 case 'configuration-dir':
73 case 'cms-package-dir':
74 $val = rtrim($this->
process($this->config[$key], $flags),
'/\\');
75 return ($flags & self::RELATIVE_PATHS == 1) ? $val : $this->
realpath($val);
77 if (!isset($this->config[$key])) {
80 return $this->
process($this->config[$key], $flags);
88 public function all($flags = 0) {
90 foreach (array_keys($this->config) as $key) {
91 $all[
'config'][$key] = $this->
get($key, $flags);
102 'config' => $this->config,
112 public function has($key) {
113 return array_key_exists($key, $this->config);
126 if (!is_string($value)) {
130 return preg_replace_callback(
'#\{\$(.+)\}#',
131 function ($match) use (
$config, $flags) {
132 return $config->get($match[1], $flags);
146 if (substr($path, 0, 1) ===
'/' || substr($path, 1, 1) ===
':') {
150 return $this->baseDir .
'/' . $path;
164 static public function load(\Composer\Composer $composer) {
167 $baseDir = static::extractBaseDir($composer->getConfig());
169 $rootPackageExtraConfig = $composer->getPackage()->getExtra();
170 if (is_array($rootPackageExtraConfig)) {
171 $config->merge($rootPackageExtraConfig);
175 'typo3/cms' => array(
176 'vendor-dir' => $composer->getConfig()->get(
'vendor-dir')
189 $reflectionClass = new \ReflectionClass($config);
190 $reflectionProperty = $reflectionClass->getProperty(
'baseDir');
191 $reflectionProperty->setAccessible(
true);
192 return $reflectionProperty->getValue($config);