protected function execute(InputInterface $input, OutputInterface $output) { $config = new Config(); $config->setBasePath(getcwd()); $config->setFromArray($input->getArguments()); $config->setFromArray($input->getOptions()); $moduleConfig = new ConfigWriter($config); $state = new State($moduleConfig); $builder = new OptionsContainer($config); $builder->addBuilder(new ExceptionContainer($config)); $builder->prepare($state); $builder->build($state); $writeState = new State($moduleConfig); $models = array('options' => $state->getModel('options'), 'factory' => $state->getModel('options-factory'), 'trait' => $state->getModel('options-trait')); foreach (array_keys($models) as $key) { if ($input->getOption('no-' . $key)) { $models[$key] = false; } if ($input->getOption('only-' . $key)) { foreach (array_keys($models) as $index) { if ($key != $index) { $models[$index] = false; } } } } foreach ($models as $model) { if ($model) { $writeState->addModel($model); } } $writer = new ModelWriter($config); $writer->write($writeState, $output); $moduleConfig->save($output); }
public function testConstruct() { $container = new OptionsContainer($this->getConfig()); $builders = $container->getBuilders(); $this->assertCount(3, $builders); }