Skip to content

Commit

Permalink
Merge pull request #221 from jmolivas/config-debug-update
Browse files Browse the repository at this point in the history
Config debug update
  • Loading branch information
jmolivas committed Oct 16, 2014
2 parents cc7c33f + db0916f commit 75c454f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/Command/ConfigDebugCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,23 @@ protected function execute(InputInterface $input, OutputInterface $output)
{
$config_name = $input->getArgument('config-name');

$container = $this->getContainer();
$configFactory = $container->get('config.factory');

$table = $this->getHelperSet()->get('table');
$table->setlayout($table::LAYOUT_COMPACT);

if (!$config_name) {
$this->getAllConfigurations($output, $table, $configFactory);
$this->getAllConfigurations($output, $table);
}
else {
$configStorage = $container->get('config.storage');
$this->getConfigurationByName($output, $table, $configStorage, $config_name);
$this->getConfigurationByName($output, $table, $config_name);
}
}

/**
* @param $output OutputInterface
* @param $table TableHelper
* @param $configFactory ConfigFactory
*/
private function getAllConfigurations($output, $table, $configFactory){
*/
private function getAllConfigurations($output, $table){
$configFactory = $this->getConfigFactory();
$names = $configFactory->listAll();
$table->setHeaders(['Name']);
foreach ($names as $name) {
Expand All @@ -64,10 +60,10 @@ private function getAllConfigurations($output, $table, $configFactory){
/**
* @param $output OutputInterface
* @param $table TableHelper
* @param $configStorage ConfigStorage
* @param $config_name String
*/
private function getConfigurationByName($output, $table, $configStorage, $config_name){
private function getConfigurationByName($output, $table, $config_name){
$configStorage = $this->getConfigStorage();
if ($configStorage->exists($config_name)) {
$table->setHeaders([$config_name]);

Expand Down
8 changes: 8 additions & 0 deletions src/Command/ContainerAwareCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ public function getValidator()
return $this->getContainer()->get('console.validators');
}

public function getConfigFactory(){
return $this->getContainer()->get('config.factory');
}

public function getConfigStorage(){
return $this->getContainer()->get('config.storage');
}

public function validateModuleExist($module_name)
{
return $this->getValidator()->validateModuleExist($module_name, $this->getModules());
Expand Down

0 comments on commit 75c454f

Please sign in to comment.