Copy the environment file.

@return void
500104
protected function configureEnvironmentFile()
    {
        $dir = app()->environmentPath();
        $file = app()->environmentFile();
        $path = "{$dir}/{$file}";

        if (file_exists($path)) {
            $this->line('Environment file already exists. Moving on.');

            return;
        }

        copy("$path.example", $path);
    }
1361855
public function patch(
        EnvironmentInterface $environment
    ) {
        $this->copyDirectory(
            $environment->getDefaultsFilesystem(),
            $environment->getIdeConfigFilesystem(),
            'fileTemplates'
        );

        $this->patchWorkspaceConfig(
            $environment->getIdeConfigFilesystem()
        );
    }
99490
public function envCommand(): void
    {
        $info = [
            'phpVersion' => PHP_VERSION,
            'env'        => 'test',
            'debug'      => true,
        ];

        Show::panel($info);

        echo Php::printVars($_SERVER);
    }
51383
private function backup()
    {
        if (! $this->disk->exists(storage_path('langmanGUI'))) {
            $this->disk->makeDirectory(storage_path('langmanGUI'));

            $this->disk->put(storage_path('langmanGUI'.'/.gitignore'), "*\n!.gitignore");
        }

        $this->disk->copyDirectory(resource_path('lang'), storage_path('langmanGUI/'.time()));
    }
144460
protected function copyDockerServiceFiles()
    {
        $root = ProjectX::projectRoot() . "/docker/services";
        $configs = $this->getProjectServiceConfigs();
        $project_type = $this->getProjectType();

        foreach ($this->getServices() as $name => $info) {
            if (!isset($info['type'])) {
                continue;
            }
            $type = $info['type'];

            /** @var DockerService $instance */
            $instance = self::loadService($this, $type, $name);

            if (isset($info['version'])) {
                $instance->setVersion($info['version']);
            }

            if (isset($configs[$type])) {
                $instance->setConfigs($configs[$type]);
            }

            foreach ($instance->templateFiles() as $template => $temp_info) {
                $paths = [
                    "{$type}/{$project_type}/{$template}",
                    "{$type}/{$template}"
                ];
                foreach ($paths as $path) {
                    $filepath = $this->getTemplateFilePath($path);

                    if (false !== $filepath) {
                        $filesystem = $this->taskFilesystemStack();
                        $destination = "{$root}/{$type}";

                        if (!file_exists($destination)) {
                            $filesystem->mkdir($destination);
                        }
                        $filename = basename($filepath);
                        $destination = "{$destination}/{$filename}";

                        $overwrite = isset($temp_info['overwrite'])
                            ? $temp_info['overwrite']
                            : false;

                        $status = $filesystem
                            ->copy($filepath, $destination, $overwrite)
                            ->run();

                        if ($status->wasSuccessful()
                            && !empty($temp_info['variables'])) {
                            $file_task = $this
                                ->taskWriteToFile($destination)
                                ->append();

                            foreach ($temp_info['variables'] as $name => $value) {
                                $file_task->place($name, $value);
                            }

                            $file_task->run();
                        }

                        break;
                    }
                }
            }
        }

        return $this;
    }
399510
public function copy(EnvironmentInterface $environment, ModelIdInterface $modelId)
    {
        $this->guardNotEditOnly($environment->getDataDefinition(), $modelId);
        $this->guardIsCreatable($environment, $modelId);

        $dataProvider = $environment->getDataProvider();
        $model        = $dataProvider->fetch($dataProvider->getEmptyConfig()->setId($modelId->getId()));

        // We need to keep the original data here.
        $copyModel = $environment->getController()->createClonedModel($model);

        $eventDispatcher = $environment->getEventDispatcher();
        // Dispatch pre duplicate event.
        $preCopyEvent = new PreDuplicateModelEvent($environment, $copyModel, $model);
        $eventDispatcher->dispatch($preCopyEvent::NAME, $preCopyEvent);

        // Save the copy.
        $environment->getDataProvider($copyModel->getProviderName())->save($copyModel);

        // Dispatch post duplicate event.
        $postCopyEvent = new PostDuplicateModelEvent($environment, $copyModel, $model);
        $eventDispatcher->dispatch($postCopyEvent::NAME, $postCopyEvent);

        return $copyModel;
    }
1258096
def copy_files(src,dest,module_model)
      module_model.each do |file|
        presence = File.exists?("#{dest}/#{file}")? true : false
        unless presence
          FileUtils.cp("#{src}/#{file}",dest)
          path = if dest.include? "app" then "app/models" else "db/migrate" end
          $stdout.puts "\e[1;32m \tcreate\e[0m\t#{path}/#{file}"
        end
      end
    end
1230490
protected function configure()
    {
        $this
            ->setName($this->getName())
            ->setDescription($this->getDescription())
            ->addOption(
                'storage',
                null,
                InputOption::VALUE_OPTIONAL,
                'Environment Location Storage',
                $this->getDefaultFileName()
            );
    }
1240395
public function copy($file)
    {
        $fs = new Filesystem;

        if (! $fs->exists(dirname($file))) {
            $fs->mkdir(dirname($file), 0755);
        }

        $fs->copy($this->source, $file, true);
    }
341361
private function copy()
    {
        $source = Yii::getAlias($this->source);
        if (!file_exists($source) || !is_dir($source)) {
            throw new ErrorException("Source directory {$this->source} not found");
        }
        $destination = Yii::getAlias($this->destination);
        if (!$this->replace && is_dir($destination)) { // if replace is disabled we will skip existing files
            $this->keepFiles = FileHelper::findFiles($destination);
        }
        FileHelper::copyDirectory($source, $destination, [
            'except' => ['.git/'],
            'fileMode' => 0775,
            'beforeCopy' => function ($from, $to) {
                return $this->replace || !file_exists($to) || !is_file($to);
            }
        ]);
        return true;
    }
1316799
private function copyConfigFile()
    {
        $path = $this->getConfigPath();

        // if generatords config already exist
        if ($this->files->exists($path) && $this->option('force') === false) {
            $this->error("{$path} already exists! Run 'generate:publish-stubs --force' to override the config file.");
            die;
        }

        File::copy(__DIR__ . '/../config/config.php', $path);
    }
1025240
protected function writeNewEnvironmentFileWith($keys)
    {
        $contents = file_get_contents($this->laravel->environmentFilePath());

        if (! Str::contains($contents, 'VAPID_PUBLIC_KEY')) {
            $contents .= PHP_EOL.'VAPID_PUBLIC_KEY=';
        }

        if (! Str::contains($contents, 'VAPID_PRIVATE_KEY')) {
            $contents .= PHP_EOL.'VAPID_PRIVATE_KEY=';
        }

        $contents = preg_replace(
            [
                $this->keyReplacementPattern('VAPID_PUBLIC_KEY'),
                $this->keyReplacementPattern('VAPID_PRIVATE_KEY'),
            ],
            [
                'VAPID_PUBLIC_KEY='.$keys['publicKey'],
                'VAPID_PRIVATE_KEY='.$keys['privateKey'],
            ],
            $contents
        );

        file_put_contents($this->laravel->environmentFilePath(), $contents);
    }
315845
public function patch(
        EnvironmentInterface $environment
    ) {
        $this->copyDirectory(
            $environment->getDefaultsFilesystem(),
            $environment->getIdeConfigFilesystem(),
            'inspectionProfiles'
        );

        $this->setProjectProfiles($environment);
    }
501733
protected function reloadEnvironment()
    {
        // Reload the environment variables from the file.
        (new Dotenv(app()->environmentPath(), app()->environmentFile()))->overload();

        // Reload the config repository.
        $loader = new LoadConfiguration;
        $this->callSilent('config:clear');
        $loader->bootstrap(app());
    }
669398
protected function initEnvironment()
    {
        $path = getcwd();
        if (!is_file("$path/.env")) {
            return;
        }
        $dotenv = new \Dotenv\Dotenv($path);
        if ($this->dotEnvOverload) {
            $dotenv->overload();
        } else {
            $dotenv->load();
        }
    }
947270
protected function init()
    {
        $this->addCommand(CopyConfigCommand::class);
        $this->addCommand(InstallCommand::class);

        $this->addGlobalOption('e')
            ->alias('env')
            ->description('The environment application name or class.')
            ->defaultValue('dev');
    }
560523
protected function loadEnvFile($file) {
    list($name, ,) = explode('.', $file->name);
    $this->environments[$name] = $this->extractEnv($file->filename);
    $this->environments[$name]['filename'] = $this->parseFilename($file->filename);
  }