-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from kschroeder/develop
Oh geez, two things. Added configuration:list-keys and made configur…
- Loading branch information
Showing
16 changed files
with
288 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace Magium\Configuration\Console\Command; | ||
|
||
use Magium\Configuration\MagiumConfigurationFactory; | ||
use Magium\Configuration\MagiumConfigurationFactoryInterface; | ||
|
||
trait ConfigurationFactoryTrait | ||
{ | ||
|
||
public function setConfigurationFactory(MagiumConfigurationFactoryInterface $factory) | ||
{ | ||
$this->factory = $factory; | ||
} | ||
|
||
protected function getConfigurationFactory() | ||
{ | ||
if (!$this->factory instanceof MagiumConfigurationFactoryInterface) { | ||
$this->factory = new MagiumConfigurationFactory(); | ||
} | ||
return $this->factory; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
|
||
namespace Magium\Configuration\Console\Command; | ||
|
||
use Magium\Configuration\Config\Config; | ||
use Magium\Configuration\MagiumConfigurationFactory; | ||
use Magium\Configuration\MagiumConfigurationFactoryInterface; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
class ConfigurationListKeys extends Command | ||
{ | ||
|
||
const COMMAND = 'magium:configuration:list-keys'; | ||
|
||
const INITIAL_MESSAGE = 'Valid configuration keys'; | ||
|
||
protected $factory; | ||
|
||
protected function configure() | ||
{ | ||
$this | ||
->setName(self::COMMAND) | ||
->setDescription('List configuration settings') | ||
->setHelp("This command lists all of the configuration setting options") | ||
; | ||
} | ||
|
||
public function getConfigurationFactory() | ||
{ | ||
if (!$this->factory instanceof MagiumConfigurationFactoryInterface) { | ||
$this->factory = new MagiumConfigurationFactory(); | ||
} | ||
return $this->factory; | ||
} | ||
|
||
public function setConfigurationFactory(MagiumConfigurationFactoryInterface $factory) | ||
{ | ||
$this->factory = $factory; | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
$factory = $this->getConfigurationFactory(); | ||
$builder = $factory->getBuilder(); | ||
$merged = $builder->getMergedStructure(); | ||
$merged->registerXPathNamespace('s', 'http://www.magiumlib.com/Configuration'); | ||
$elements = $merged->xpath('//s:element'); | ||
$output->writeln(self::INITIAL_MESSAGE); | ||
foreach ($elements as $element) { | ||
$elementId = (string)$element['id']; | ||
$parent = $element->xpath('..'); | ||
$groupId = (string)$parent[0]['id']; | ||
$parent = $parent[0]->xpath('..'); | ||
$sectionId = (string)$parent[0]['id']; | ||
$description = ''; | ||
if (isset($element->description)) { | ||
$description = sprintf(' (%s)', (string)$element->description); | ||
} | ||
|
||
$out = sprintf('%s/%s/%s%s', $sectionId, $groupId, $elementId, $description); | ||
$output->writeln($out); | ||
|
||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
namespace Magium\Configuration\Console\Command; | ||
|
||
class UnconfiguredPathException extends \Exception {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.