MergeYamlCommand.php in Database Sanitize 7
File
vendor/edisonlabs/merge-yaml/src/MergeYamlCommand.php
View source
<?php
namespace EdisonLabs\MergeYaml;
use Composer\Command\BaseCommand;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class MergeYamlCommand extends BaseCommand {
public function execute(InputInterface $input, OutputInterface $output, array $configParameters = []) {
$configFile = $input
->getOption('config');
if ($configFile && empty($configParameters)) {
$filePath = realpath($configFile);
if (!$filePath || !($configfileContent = file_get_contents($filePath))) {
throw new \RuntimeException("Unable to load the config file {$configFile}");
}
$configParameters = json_decode($configfileContent, true);
}
$mergeYaml = new PluginHandler($this
->getComposer(), $this
->getIO(), $configParameters);
$mergeYaml
->createMergeFiles();
}
protected function configure() {
parent::configure();
$this
->setName('merge-yaml')
->setDefinition($this
->createDefinition())
->setDescription('Merge yaml files.');
}
private function createDefinition() {
return new InputDefinition(array(
new InputOption('config', null, InputOption::VALUE_OPTIONAL, 'A json file containing the plugin configuration.'),
));
}
}