AbstractCIConfigureCIEvent::afterExecute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace TheAentMachine\Aent\Event\CI;
4
5
use Safe\Exceptions\StringsException;
6
use TheAentMachine\Aent\Event\AbstractJsonEvent;
7
use function Safe\sprintf;
8
9
abstract class AbstractCIConfigureCIEvent extends AbstractJsonEvent
10
{
11
    /**
12
     * @return array<string,string>
13
     */
14
    abstract protected function getMetadata(): array;
15
16
    /**
17
     * @return string
18
     */
19
    protected function getEventName(): string
20
    {
21
        return 'CONFIGURE_CI';
22
    }
23
24
    /**
25
     * @return bool
26
     */
27
    protected function shouldRegisterEvents(): bool
28
    {
29
        return false;
30
    }
31
32
    /**
33
     * @return void
34
     * @throws StringsException
35
     */
36
    protected function beforeExecute(): void
37
    {
38
        $this->output->writeln(sprintf("\nšŸ‘‹ Hello! I'm the aent <info>%s</info> and I'll ask you a few questions about your project.", $this->getAentName()));
39
    }
40
41
    /**
42
     * @param mixed[] $payload
43
     * @return array<string,string>|null
44
     */
45
    protected function executeJsonEvent(array $payload): ?array
46
    {
47
        return $this->getMetadata();
48
    }
49
50
    /**
51
     * @return void
52
     */
53
    protected function afterExecute(): void
54
    {
55
        $this->output->writeln("\nNo more questions, see you later!");
56
    }
57
}
58