Some PSR2 code styling and test coverage enabled

This commit is contained in:
Michał Brzuchalski
2016-06-14 10:01:14 +02:00
parent b8bd71e265
commit 6e22a75a2e
10 changed files with 88 additions and 17 deletions

View File

@@ -5,15 +5,18 @@
* Date: 10.06.16
* Time: 14:25
*/
namespace Madkom\NginxConfigurator\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Class AddLocationCommand
* @package Madkom\NginxConfigurator\Command
* @author Michał Brzuchalski <m.brzuchalski@madkom.pl>
*/
class AddLocationCommand extends BaseCommand
{
protected function configure()
@@ -23,11 +26,37 @@ class AddLocationCommand extends BaseCommand
$this->setDescription("Adds location context and configuration");
$this->addArgument('name', InputArgument::OPTIONAL, 'Server hostname:port', 'localhost:80');
$this->addOption('internal', null, InputOption::VALUE_NONE, 'Adds internal directive');
$this->addOption('proxy_pass', null, InputOption::VALUE_OPTIONAL, 'Adds proxy_pass url <comment>(eg. http://proxy/)</comment>');
$this->addOption('proxy_bind', null, InputOption::VALUE_OPTIONAL, 'Adds proxy_bind directive url or variable <comment>(eg. $server_addr)</comment>');
$this->addOption('proxy_redirect', null, InputOption::VALUE_OPTIONAL ^ InputOption::VALUE_IS_ARRAY, 'Adds proxy_redirect directive <comment>(eg. http://$host or https://$host)</comment>');
$this->addOption('proxy_set_header', null, InputOption::VALUE_OPTIONAL ^ InputOption::VALUE_IS_ARRAY, 'Adds proxy_set_header directive <comment>(eg. "Content-Type: text/html"</comment>');
$this->addOption('proxy_pass_request_body', null, InputOption::VALUE_OPTIONAL, 'Adds proxy_pass_requeest_body directive <comment>(on|off)</comment>', 'on');
$this->addOption(
'proxy_pass',
null,
InputOption::VALUE_OPTIONAL,
'Adds proxy_pass url <comment>(eg. http://proxy/)</comment>'
);
$this->addOption(
'proxy_bind',
null,
InputOption::VALUE_OPTIONAL,
'Adds proxy_bind directive url or variable <comment>(eg. $server_addr)</comment>'
);
$this->addOption(
'proxy_redirect',
null,
InputOption::VALUE_OPTIONAL ^ InputOption::VALUE_IS_ARRAY,
'Adds proxy_redirect directive <comment>(eg. http://$host or https://$host)</comment>'
);
$this->addOption(
'proxy_set_header',
null,
InputOption::VALUE_OPTIONAL ^ InputOption::VALUE_IS_ARRAY,
'Adds proxy_set_header directive <comment>(eg. "Content-Type: text/html"</comment>'
);
$this->addOption(
'proxy_pass_request_body',
null,
InputOption::VALUE_OPTIONAL,
'Adds proxy_pass_requeest_body directive <comment>(on|off)</comment>',
'on'
);
// // new Directive('internal'),
// new Directive('expires', [new Param('-1')]),
@@ -40,7 +69,7 @@ class AddLocationCommand extends BaseCommand
protected function execute(InputInterface $input, OutputInterface $output)
{
$proxy_pass = $input->getOption('proxy_pass');
}

View File

@@ -49,7 +49,7 @@ class AddServerCommand extends BaseCommand
$config->append($server);
$builder = new Builder();
$builder->appendServerNode($server);
$builder->append($server);
$builder->dumpFile($filename);
}
}

View File

@@ -20,4 +20,4 @@ class AddUpstreamServerCommand extends BaseCommand
$this->setName('upstream:server:add');
$this->setDescription("Adds server directive to upstream context and configuration");
}
}
}

View File

@@ -20,4 +20,4 @@ class RemoveUpstreamServerCommand extends BaseCommand
$this->setName('upstream:server:remove');
$this->setDescription("Removes server directive from upstream context and configuration");
}
}
}

View File

@@ -165,7 +165,7 @@ class Parser extends Grammar
* @throws GrammarException
* @throws UnrecognizedContextException
*/
protected function parseSection($section, $space0 = null, $params, $open = null, $space1 = null, $directives) : Context
protected function parseSection($section, $space0, $params, $open, $space1, $directives) : Context
{
switch ($section) {
case 'server':