src/configs/Config.php
protected function writePhpFile(string $path, $data, bool $withEnv, bool $withDefines): void
    {
        static::putFile($path, $this->replaceMarkers(implode("\n\n", array_filter([
            'header'  => '<?php',
            'baseDir' => '$baseDir = dirname(dirname(dirname(__DIR__)));',
            'BASEDIR' => "defined('COMPOSER_CONFIG_PLUGIN_BASEDIR') or define('COMPOSER_CONFIG_PLUGIN_BASEDIR', \$baseDir);",
            'dotenv'  => $withEnv ? "\$_ENV = array_merge((array) require __DIR__ . '/dotenv.php', (array) \$_ENV);" : '',
            'defines' => $withDefines ? $this->builder->getConfig('defines')->buildRequires() : '',
            'content' => is_array($data) ? $this->renderVars($data) : $data,
        ]))) . "\n");
    }
protected function writePhpFile(string $path, $data, bool $withEnv, bool $withDefines): void
    {
        static::putFile($path, $this->replaceMarkers(implode("\n\n", array_filter([
            'header'  => '<?php',
            'baseDir' => '$baseDir = dirname(dirname(dirname(__DIR__)));',
            'BASEDIR' => "defined('COMPOSER_CONFIG_PLUGIN_BASEDIR') or define('COMPOSER_CONFIG_PLUGIN_BASEDIR', \$baseDir);",
            'dotenv'  => $withEnv ? "\$_ENV = array_merge((array) require __DIR__ . '/dotenv.php', (array) \$_ENV);" : '',
            'defines' => $withDefines ? $this->builder->getConfig('defines')->buildRequires() : '',
            'content' => is_array($data) ? $this->renderVars($data) : $data,
        ]))) . "\n");
    }
protected function writePhpFile ( string $ path , $ data , bool $ withEnv , bool $ withDefines ) : void { static :: putFile ( $ path , $ this -> replaceMarkers ( implode ( "\n\n" , array_filter ( [ 'header' => '<?php' , 'baseDir' => '$baseDir = dirname(dirname(dirname(__DIR__)));' , 'BASEDIR' => "defined('COMPOSER_CONFIG_PLUGIN_BASEDIR') or define('COMPOSER_CONFIG_PLUGIN_BASEDIR', \$baseDir);" , 'dotenv' => $ withEnv ? "\$_ENV = array_merge((array) require __DIR__ . '/dotenv.php', (array) \$_ENV);" : '' , 'defines' => $ withDefines ? $ this -> builder -> getConfig ( 'defines' ) -> buildRequires ( ) : '' , 'content' => is_array ( $ data ) ? $ this -> renderVars ( $ data ) : $ data , ] ) ) ) . "\n" ) ; }
Writes complete PHP config file by full path.
@param string $path
@param string|array $data
@param bool $withEnv
@param bool $withDefines
@throws FailedWriteException
@throws \ReflectionException
Writes complete PHP config file by full path .