Completed
Push — master ( f0448f...4201d1 )
by Julien
14s
created

AddEventCommand::execute()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 2
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace TheAentMachine\AentDockerCompose\Command;
4
5
use Symfony\Component\Console\Input\InputInterface;
6
use Symfony\Component\Console\Output\OutputInterface;
7
use TheAentMachine\AentDockerCompose\Aenthill\Enum\EventEnum;
8
use TheAentMachine\AentDockerCompose\Aenthill\Hercule;
9
use TheAentMachine\AentDockerCompose\Aenthill\Hermes;
10
11
class AddEventCommand extends EventCommand
12
{
13
    protected function configure()
14
    {
15
        $this->setName(EventEnum::ADD);
16
    }
17
18
    /**
19
     * @param InputInterface $input
20
     * @param OutputInterface $output
21
     * @return int
22
     */
23
    protected function execute(InputInterface $input, OutputInterface $output): int
24
    {
25
        $exitCode = Hercule::setHandledEvents([EventEnum::NEW_DOCKER_SERVICE_INFO]);
26
        if ($exitCode === 1) {
27
            return $exitCode;
28
        }
29
30
        return Hermes::dispatch(EventEnum::ASKING_FOR_DOCKER_SERVICE_INFO);
31
    }
32
}
33