/**
  * @param \Symfony\Component\Console\Input\InputInterface $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  *
  * @return null|int null or 0 if everything went fine, or an error code
  */
 public function generate(InputInterface $input, OutputInterface $output)
 {
     $file_loader = \Config::getLoader();
     $group_files = $this->getConfigGroupFiles();
     foreach ($group_files as $group => $file) {
         $contents = $file_loader->load("", $group, "core");
         $items = $this->flattenItem($contents, $group);
         $comments = $this->getCommentRepository($file);
         $output->writeln(array("# `{$group}` : `{$file}`", '', 'Config Key | Type | Description | Value', '---------- | ---- | ----------- |------'));
         foreach ($items as $key => $item) {
             list($type, $value) = $item;
             $description = "No Description";
             if ($docblock = $comments->getDocblock($key)) {
                 list($inline_type, $inline_description) = $this->getDocblockInfo($docblock);
                 if ($inline_description) {
                     $description = $inline_description;
                 }
                 if ($inline_type) {
                     $type = $inline_type;
                 }
             }
             $output->writeln("`{$key}` | `{$type}` | {$description} | `{$value}`");
         }
         $output->writeln('');
     }
 }
Example #2
0
 public static function set($key, $value)
 {
     // save to config
     Config::getLoader()->set($key, $value);
     Config::set($key, $value);
     // return
     return Config::get($key);
 }
 protected function getAppConfig()
 {
     if (!$this->app_config) {
         $file_loader = \Config::getLoader();
         $this->app_config = $file_loader->load('', 'app', 'core');
     }
     return $this->app_config;
 }
 public function generate(InputInterface $input, OutputInterface $output)
 {
     $file_loader = \Config::getLoader();
     $app_config = $file_loader->load('', 'app', 'core');
     $providers = array_get($app_config, 'providers', array());
     /** @type CommentRepositoryFactory $comment_repository_factory */
     $comment_repository_factory = \Core::make('documentation_generator/comment_repository_factory');
     $comment_repository = $comment_repository_factory->makeCommentRepository(DIR_BASE_CORE . "/config/app.php");
     $markdown = array("Handle | Class | Description", " --- | --- | ---");
     foreach ($providers as $handle => $class) {
         $docblock = $comment_repository->getDocblock("app.providers.{$handle}");
         $description = $docblock ? $docblock->getShortDescription() : '';
         $markdown[] = "`{$handle}` | `{$class}` | {$description}";
     }
     $output->writeln($markdown);
 }
Example #5
0
 /**
  * Get dir loader
  * @covers Jasny\Config::getLoader()
  */
 public function testGetLoader_DirLoader()
 {
     $loader = $this->config->getLoader(CONFIGTEST_SUPPORT_PATH . '/test');
     $this->assertInstanceOf('Jasny\\Config\\DirLoader', $loader);
 }