|
1
|
|
|
<?php |
|
2
|
|
|
declare(strict_types=1); |
|
3
|
|
|
|
|
4
|
|
|
/** |
|
5
|
|
|
* Command Class |
|
6
|
|
|
* @category Ticaje |
|
7
|
|
|
* @package Ticaje_Dummy |
|
8
|
|
|
* @author Hector Luis Barrientos <[email protected]> |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace Ticaje\Dummy\Console\Command; |
|
12
|
|
|
|
|
13
|
|
|
use Symfony\Component\Console\Command\Command; |
|
14
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
|
15
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
16
|
|
|
|
|
17
|
|
|
use Ticaje\Dummy\Configuration\ConnectorInterface; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Class Configuration |
|
21
|
|
|
* @package Ticaje\Dummy\Console\Command |
|
22
|
|
|
*/ |
|
23
|
|
|
class Configuration extends Command |
|
24
|
|
|
{ |
|
25
|
|
|
private $connectorConfiguration; |
|
26
|
|
|
|
|
27
|
|
|
public function __construct( |
|
28
|
|
|
ConnectorInterface $connector, |
|
29
|
|
|
string $name = null |
|
30
|
|
|
) { |
|
31
|
|
|
$this->connectorConfiguration = $connector; |
|
32
|
|
|
parent::__construct($name); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
protected function configure() |
|
36
|
|
|
{ |
|
37
|
|
|
$this->setName("ticaje:test:configuration"); |
|
38
|
|
|
$this->setDescription("Testing configurations refactor workaround."); |
|
39
|
|
|
parent::configure(); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
protected function execute(InputInterface $input, OutputInterface $output) |
|
43
|
|
|
{ |
|
44
|
|
|
$output->writeln("Starting command..."); |
|
45
|
|
|
$this->launch($output); |
|
46
|
|
|
$output->writeln("Finishing command..."); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @param OutputInterface $output |
|
51
|
|
|
* Creating room for launching any config method |
|
52
|
|
|
* @todo Refactor later on |
|
53
|
|
|
*/ |
|
54
|
|
|
protected function launch(OutputInterface $output) |
|
55
|
|
|
{ |
|
56
|
|
|
$output->writeln("Launching config command..."); |
|
57
|
|
|
$url = $this->connectorConfiguration->getBaseUri(); |
|
58
|
|
|
$enabled = $this->connectorConfiguration->isEnabled(); |
|
|
|
|
|
|
59
|
|
|
$debug = $this->connectorConfiguration->inDebugMode(); |
|
|
|
|
|
|
60
|
|
|
$output->writeln("Enabled: $enabled"); |
|
61
|
|
|
$output->writeln("Base Uri: $url"); |
|
62
|
|
|
$output->writeln("Debug Mode: $debug"); |
|
63
|
|
|
} |
|
64
|
|
|
} |
|
65
|
|
|
|