Copies customized config files into vendored SimpleSamlPHP.

@command source:build:simplesamlphp-config
@aliases sbsc
@throws \Acquia\Blt\Robo\Exceptions\BltException
497264
public function simpleSamlPhpBuildConfig() {
    $this->say('Copying config files to the appropriate place in simplesamlphp library...');
    $result = $this->taskCopyDir(["{$this->repoRoot}/simplesamlphp" => "{$this->repoRoot}/vendor/simplesamlphp/simplesamlphp"])
      ->overwrite(TRUE)
      ->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
      ->run();
    if (!$result->wasSuccessful()) {
      throw new BltException("Unable to copy configuration into SimpleSamlPhp.");
    }

    $result = $this->taskFileSystemStack()
      ->copy("{$this->bltRoot}/scripts/simplesamlphp/gitignore.txt", "{$this->repoRoot}/vendor/simplesamlphp/simplesamlphp/.gitignore", TRUE)
      ->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
      ->run();
    if (!$result->wasSuccessful()) {
      throw new BltException("Unable to copy .gitignore into SimpleSamlPhp.");
    }
  }
450398
private function copyStatic()
    {
        $config = $this->getSiteConfig();

        $inDir  = new \SplFileInfo($this->getProjectDir());
        $outDir = new \SplFileInfo($this->getOutputDir());
        $skip   = isset($config['skip']) ? $config['skip'] : array();

        if (isset($config['copy'])) {
            $to_copy = (array) $config['copy'];
        } else {
            $to_copy = array();
        }

        // media folder is hardcoded into copy
        // we should remove this when we can break BC
        // this is better located in the skeleton config.yml
        $to_copy = array_merge(array('media'), $to_copy);
        $to_copy = array_unique($to_copy);

        foreach ($to_copy as $file) {
            $fileInfo = new \SplFileInfo($inDir->getPathname() . DIRECTORY_SEPARATOR . $file);
            if ($fileInfo->isDir()) {
                $this->tryToCopyFolder($fileInfo, $inDir, $outDir, $skip);
            } else {
                $this->tryToCopyFile($fileInfo, $inDir, $outDir, $skip);
            }
        }

        return $this;
    }
268005
protected function configureAliases()
    {
        $file = "{$this->basePath}/aliases.sh";
        if (file_exists($file)) {
            $fileContent = file_get_contents($file);
            $fileContent = str_replace(
                'alias p=\'cd ~/Code/artestead\'',
                'alias p=\'cd ~/Code/'.$this->defaultName.'\'',
                $fileContent
            );
            file_put_contents($file, $fileContent);
        }
    }
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;
    }
1041394
private function copy()
	{
		$this->setCopied($this->getFilesystem()->get(app_path() . '/database/seeds/DatabaseSeeder.php'));

		$this->getFilesystem()->put(app_path() . '/database/seeds/DatabaseSeeder.old', $this->getCopied());
	}
48476
function copyExampleConfig()
    {
        if (! $this->files->exists($this->configPath)) {
            $this->files->copyAsUser(
                $this->exampleConfigPath,
                $this->configPath
            );
        }
    }
803807
protected function copyFiles()
    {
        $files = new Filesystem;
        array_map(function ($file) use ($files) {
            $files->copy("{$this->stubDirectory}/{$file}", "{$this->sageRoot}/resources/assets/{$file}");
        }, $this->getFileList());
    }
113161
public function copy() {
    $destination = $this->getConfigValue('repo.root') . '/hooks';
    $this->say("Copying default Acquia cloud hooks into $destination...");
    // This WILL overwrite files is source files are newer.
    $result = $this->taskCopyDir([
      $this->getConfigValue('blt.root') . '/scripts/cloud-hooks/hooks' => $destination,
    ])
      ->run();
    $this->taskFilesystemStack()
      ->chmod($destination, 0755, 0000, TRUE)
      ->run();

    return $result;
  }
501236
protected function configure()
    {

        $filesystemAdapterNames = $this->mountManager->getFilesystemPrefixes();
        $this->setName('filesystem:sync')
            ->addArgument(
                'source',
                InputArgument::REQUIRED,
                "Source path in the format {adapter}://{path}.\nAvailable Adapters: <comment>" . implode(
                    ', ',
                    $filesystemAdapterNames
                )
                . '</comment>'
            )
            ->addArgument(
                'destination',
                InputArgument::REQUIRED,
                "Destination path in the format {adapter}://{path}.\nAvailable Adapters: <comment>" . implode(
                    ', ',
                    $filesystemAdapterNames
                )
                . '</comment>'
            )
            ->addOption(
                'delete',
                null,
                InputOption::VALUE_NONE,
                'Delete files in destination filesystem that do not exist in source'
            )
            ->addOption(
                'ignore-timestamps',
                null,
                InputOption::VALUE_NONE,
                'Push all files, even if a newer matching file exists on the destination'
            )
            ->addOption(
                'exclude',
                null,
                InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
                'Path to exclude, in rsync format'
            )
            ->addOption(
                'include',
                null,
                InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
                'Excluded path to include, in rsync format'
            )
            ->addOption(
                'batch-size',
                null,
                InputOption::VALUE_REQUIRED,
                'Batch size for copy and delete operations',
                100
            )
            ->setDescription(
                'Copy a directory from a source filesystem directory to a destination filesystem directory.'
            )
            ->setHelp(
                "This command copies a directory from a source filesystem directory to a destination filesystem directory."
            );
    }
748292
protected function prepareConfigurationFile()
    {
        $cnfFile = "[client]\n";
        $cnfParams = array();
        $configurationMapping = array(
            'user'      => 'db_user',
            'password'  => 'db_password',
            'host'      => 'db_host',
            'port'      => 'db_port',
        );

        foreach ($configurationMapping as $key => $param) {
            if ($this->params[$param]) {
                $cnfParams[$key] = $this->params[$param];
            }
        }

        if (!empty($cnfParams)) {
            foreach ($cnfParams as $key => $value) {
                $cnfFile .= "$key = \"$value\"\n";
            }

            $this->filesystem->dumpFile($this->getConfigurationFilePath(), $cnfFile);
            $this->filesystem->chmod([$this->getConfigurationFilePath()], 0600);
            $this->auth = sprintf("--defaults-extra-file=\"%s\"", $this->getConfigurationFilePath());
        }
    }
1234862
protected function scanLoadConfig(): void
    {
        /* @var SplFileInfo $directory */
        /* @var SplFileInfo $file */
        foreach (Finder::create()->directories()->depth(1)->name('Config')->in($this->modulePath()) as $directory) {
            foreach (Finder::create()->files()->name('*.php')->in($directory->getPathname()) as $file) {
                $this->mergeConfigFrom($file->getPathname(), Str::snake($directory->getRelativePath()));
            }
        }
    }
417291
@SuppressWarnings("unchecked")
    private static void copyParamsToServerConfig() {
        ServerConfig.createInstance();
        for (String moduleName : INSTANCE.m_params.keySet()) {
            Object moduleParams = INSTANCE.m_params.get(moduleName);
            Map<String, Object> paramMap = (Map<String, Object>)moduleParams;
            for (String paramName : paramMap.keySet()) {
                ServerConfig.setParam(paramName, paramMap.get(paramName));
            }
        }
    }
127388
protected function makeFiles()
    {
        $this->namespace = $this->getRootNameSpace();

        $this->className = $this->getClassName();

        // copy files
        $this->copy([
            __DIR__.'/stubs/extension/view.stub'       => 'resources/views/index.blade.php',
            __DIR__.'/stubs/extension/.gitignore.stub' => '.gitignore',
            __DIR__.'/stubs/extension/README.md.stub'  => 'README.md',
            __DIR__.'/stubs/extension/LICENSE.stub'    => 'LICENSE',
        ]);

        // make composer.json
        $composerContents = str_replace(
            [':package', ':namespace', ':class_name'],
            [$this->package, str_replace('\\', '\\\\', $this->namespace).'\\\\', $this->className],
            file_get_contents(__DIR__.'/stubs/extension/composer.json.stub')
        );
        $this->putFile('composer.json', $composerContents);

        // make class
        $classContents = str_replace(
            [':namespace', ':class_name', ':title', ':path', ':base_package'],
            [$this->namespace, $this->className, Str::title($this->className), basename($this->package), basename($this->package)],
            file_get_contents(__DIR__.'/stubs/extension/extension.stub')
        );
        $this->putFile("src/{$this->className}.php", $classContents);

        // make service provider
        $providerContents = str_replace(
            [':namespace', ':class_name', ':base_package', ':package'],
            [$this->namespace, $this->className, basename($this->package), $this->package],
            file_get_contents(__DIR__.'/stubs/extension/service-provider.stub')
        );
        $this->putFile("src/{$this->className}ServiceProvider.php", $providerContents);

        // make controller
        $controllerContent = str_replace(
            [':namespace', ':class_name', ':base_package'],
            [$this->namespace, $this->className, basename($this->package)],
            file_get_contents(__DIR__.'/stubs/extension/controller.stub')
        );
        $this->putFile("src/Http/Controllers/{$this->className}Controller.php", $controllerContent);

        // make routes
        $routesContent = str_replace(
            [':namespace', ':class_name', ':path'],
            [$this->namespace, $this->className, basename($this->package)],
            file_get_contents(__DIR__.'/stubs/extension/routes.stub')
        );
        $this->putFile('routes/web.php', $routesContent);
    }
1164988
private function copyConfig()
    {
        // copy config
        $this->filesystem->copy($this->basePath . "config/config.php", config_path('titan.php'));
        $this->line("Config Copied: " . config_path('titan.php'));
    }
232962
def copy_config(config, mutable_config_keys=MUTABLE_CONFIG_KEYS):
    

    cloned_config = copy(config)
    # Apply ``copy`` function to mutable config values
    for key in mutable_config_keys:
        cloned_config[key] = copy(config[key])
    return cloned_config
355769
public function createCopy(): AbstractResize
    {
        $this->createCanvas();

        $this->intermediate['copy'] = imagecreatefrompng($this->source['path'] . $this->source['file']);
        if ($this->intermediate['copy'] === false) {
            throw new \Exception('Call to imagecreatefrompng failed');
        }

        $this->resampleCopy();

        return $this;
    }
1068914
protected function installShop()
    {
        $config = $this->getTestConfig();

        $serviceCaller = new ServiceCaller($this->getTestConfig());
        $serviceCaller->setParameter('serial', $config->getShopSerial());
        $serviceCaller->setParameter('addDemoData', $this->addDemoData);
        $serviceCaller->setParameter('turnOnVarnish', $config->shouldEnableVarnish());

        if ($setupPath = $config->getShopSetupPath()) {
            $fileCopier = new FileCopier();
            $remoteDirectory = $config->getRemoteDirectory();
            $shopDirectory = $remoteDirectory ? $remoteDirectory : $config->getShopPath();
            $fileCopier->copyFiles($setupPath, $shopDirectory.'/Setup/');
        }

        try {
            $serviceCaller->callService('ShopInstaller');
        } catch (\Exception $e) {
            exit("Failed to install shop with message: " . $e->getMessage() . PHP_EOL . $e->getTraceAsString());
        }
    }