public function setupDrupalLocalSettings()
    {
        $version = $this->getProjectVersion();

        $local_settings = $this
            ->templateManager()
            ->loadTemplate("{$version}/settings.local.txt");

        $this->_remove($this->settingLocalFile);

        if ($version >= 8) {
            $setting_path = "{$this->sitesPath}/example.settings.local.php";
            if (file_exists($setting_path)) {
                $this->_copy($setting_path, $this->settingLocalFile);
            } else {
                $this->taskWriteToFile($this->settingLocalFile)
                    ->text("<?php\r\n")
                    ->run();
            }
        } else {
            $this->taskWriteToFile($this->settingLocalFile)
                ->text("<?php\r\n")
                ->run();
        }
        $database = $this->getDatabaseInfo();

        $this->taskWriteToFile($this->settingLocalFile)
            ->append()
            ->appendUnlessMatches('/\$databases\[.+\]/', $local_settings)
            ->place('DB_NAME', $database->getDatabase())
            ->place('DB_USER', $database->getUser())
            ->place('DB_PASS', $database->getPassword())
            ->place('DB_HOST', $database->getHostname())
            ->place('DB_PORT', $database->getPort())
            ->place('DB_PROTOCOL', $database->getProtocol())
            ->run();

        return $this;
    }
public function setupDrupalLocalSettings()
    {
        $version = $this->getProjectVersion();

        $local_settings = $this
            ->templateManager()
            ->loadTemplate("{$version}/settings.local.txt");

        $this->_remove($this->settingLocalFile);

        if ($version >= 8) {
            $setting_path = "{$this->sitesPath}/example.settings.local.php";
            if (file_exists($setting_path)) {
                $this->_copy($setting_path, $this->settingLocalFile);
            } else {
                $this->taskWriteToFile($this->settingLocalFile)
                    ->text("<?php\r\n")
                    ->run();
            }
        } else {
            $this->taskWriteToFile($this->settingLocalFile)
                ->text("<?php\r\n")
                ->run();
        }
        $database = $this->getDatabaseInfo();

        $this->taskWriteToFile($this->settingLocalFile)
            ->append()
            ->appendUnlessMatches('/\$databases\[.+\]/', $local_settings)
            ->place('DB_NAME', $database->getDatabase())
            ->place('DB_USER', $database->getUser())
            ->place('DB_PASS', $database->getPassword())
            ->place('DB_HOST', $database->getHostname())
            ->place('DB_PORT', $database->getPort())
            ->place('DB_PROTOCOL', $database->getProtocol())
            ->run();

        return $this;
    }
public function setupDrupalLocalSettings ( ) { $ version = $ this -> getProjectVersion ( ) ; $ local_settings = $ this -> templateManager ( ) -> loadTemplate ( "{$version}/settings.local.txt" ) ; $ this -> _remove ( $ this -> settingLocalFile ) ; if ( $ version >= 8 ) { $ setting_path = "{$this->sitesPath}/example.settings.local.php" ; if ( file_exists ( $ setting_path ) ) { $ this -> _copy ( $ setting_path , $ this -> settingLocalFile ) ; } else { $ this -> taskWriteToFile ( $ this -> settingLocalFile ) -> text ( "<?php\r\n" ) -> run ( ) ; } } else { $ this -> taskWriteToFile ( $ this -> settingLocalFile ) -> text ( "<?php\r\n" ) -> run ( ) ; } $ database = $ this -> getDatabaseInfo ( ) ; $ this -> taskWriteToFile ( $ this -> settingLocalFile ) -> append ( ) -> appendUnlessMatches ( '/\$databases\[.+\]/' , $ local_settings ) -> place ( 'DB_NAME' , $ database -> getDatabase ( ) ) -> place ( 'DB_USER' , $ database -> getUser ( ) ) -> place ( 'DB_PASS' , $ database -> getPassword ( ) ) -> place ( 'DB_HOST' , $ database -> getHostname ( ) ) -> place ( 'DB_PORT' , $ database -> getPort ( ) ) -> place ( 'DB_PROTOCOL' , $ database -> getProtocol ( ) ) -> run ( ) ; return $ this ; }
Setup Drupal local settings file.

The setup process consist of the following:
- Copy over example.settings.local.php.
- Appends database connection details.

@return self
@throws \Psr\Container\ContainerExceptionInterface
@throws \Psr\Container\NotFoundExceptionInterface
@throws \Exception
Setup Drupal local settings file .