diff --git a/composer.json b/composer.json index d904f8d..c726057 100644 --- a/composer.json +++ b/composer.json @@ -53,9 +53,7 @@ "react/promise" : "~2.7", "react/socket" : "~1.2", - "psr/log" : "~1.0", - - "contributte/console" : "~0.5 || ~0.7" + "psr/log" : "~1.0" }, "require-dev" : { diff --git a/src/IPub/MQTTClient/DI/MQTTClientExtension.php b/src/IPub/MQTTClient/DI/MQTTClientExtension.php index 6cc7c04..84ffda5 100644 --- a/src/IPub/MQTTClient/DI/MQTTClientExtension.php +++ b/src/IPub/MQTTClient/DI/MQTTClientExtension.php @@ -71,6 +71,7 @@ final class MQTTClientExtension extends DI\CompilerExtension 'clean' => TRUE, ], 'loop' => NULL, + 'console' => FALSE, ]; /** @@ -111,7 +112,7 @@ public function loadConfiguration() $configuration['connection']['clean'] ); - $configuration = new Client\Configuration( + $clientConfiguration = new Client\Configuration( $configuration['broker']['httpHost'], $configuration['broker']['port'], $configuration['broker']['address'], @@ -131,17 +132,19 @@ public function loadConfiguration() ->setType(Client\Client::class) ->setArguments([ 'eventLoop' => $loop, - 'configuration' => $configuration, + 'configuration' => $clientConfiguration, ]); - // Define all console commands - $commands = [ - 'client' => Commands\ClientCommand::class, - ]; + if ($configuration['console'] === NULL) { + // Define all console commands + $commands = [ + 'client' => Commands\ClientCommand::class, + ]; - foreach ($commands as $name => $cmd) { - $builder->addDefinition($this->prefix('commands' . lcfirst($name))) - ->setType($cmd); + foreach ($commands as $name => $cmd) { + $builder->addDefinition($this->prefix('commands' . lcfirst($name))) + ->setType($cmd); + } } } diff --git a/tests/IPubTests/MQTTClient/files/config.neon b/tests/IPubTests/MQTTClient/files/config.neon index a862920..3baa847 100644 --- a/tests/IPubTests/MQTTClient/files/config.neon +++ b/tests/IPubTests/MQTTClient/files/config.neon @@ -1,13 +1,2 @@ extensions: - console: Contributte\Console\DI\ConsoleExtension(%consoleMode%) mqttClient : IPub\MQTTClient\DI\MQTTClientExtension - -console: - name: iPublikuj:Packages! - version: '1.0' - catchExceptions: true - autoExit: true - url: http://example.com - lazy: false - helperSet: \Symfony\Component\Console\Helper\HelperSet - helpers: []