diff --git a/src/Controller/BindAPI.php b/src/Controller/BindAPI.php index 5d22e0f..199de73 100755 --- a/src/Controller/BindAPI.php +++ b/src/Controller/BindAPI.php @@ -8,8 +8,12 @@ use App\Repository\DomainRepository; use App\Repository\DynDNSRepository; use DI\Container; use DI\ContainerBuilder; +use DI\DependencyException; +use DI\NotFoundException; +use Exception; use Monolog\Formatter\LineFormatter; use Monolog\Handler\StreamHandler; +use Monolog\Level; use Monolog\Logger; use function DI\autowire; @@ -23,9 +27,9 @@ class BindAPI /** - * @throws \Exception + * @throws Exception */ - public function __construct($verbose = false) + public function __construct($verbose = false, $quiet = false) { // init the logger $dateFormat = "Y:m:d H:i:s"; @@ -34,9 +38,9 @@ class BindAPI $debug = (new ConfigController)->getConfig(configKey: 'debug'); if ($debug) { - $stream = new StreamHandler(stream: dirname(path: __DIR__, levels: 2) . '/bindAPI.log', level: Logger::DEBUG); + $stream = new StreamHandler(stream: dirname(path: __DIR__, levels: 2) . '/bindAPI.log', level: Level::Debug); } else { - $stream = new StreamHandler(stream: dirname(path: __DIR__, levels: 2) . '/bindAPI.log', level: Logger::INFO); + $stream = new StreamHandler(stream: dirname(path: __DIR__, levels: 2) . '/bindAPI.log', level: Level::Info); } $stream->setFormatter(formatter: $formatter); @@ -48,6 +52,7 @@ class BindAPI $containerBuilder = new ContainerBuilder(); $containerBuilder->addDefinitions([ ConfigController::class => autowire() + ->constructorParameter(parameter: 'quiet', value: $quiet) ->constructorParameter(parameter: 'verbose', value: $verbose), CLIController::class => autowire() ->constructorParameter(parameter: 'logger', value: $this->logger), @@ -65,8 +70,8 @@ class BindAPI /** - * @throws \DI\DependencyException - * @throws \DI\NotFoundException + * @throws DependencyException + * @throws NotFoundException */ public function runCommand(array $arguments): void { @@ -77,8 +82,8 @@ class BindAPI /** - * @throws \DI\DependencyException - * @throws \DI\NotFoundException + * @throws DependencyException + * @throws NotFoundException */ public function handleRequest(string $requestMethod, array $uri): void {