ListIntentsCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 11
dl 0
loc 23
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A handle() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FondBot\Console;
6
7
use Illuminate\Console\Command;
8
use FondBot\Conversation\ConversationManager;
9
10
class ListIntentsCommand extends Command
11
{
12
    protected $signature = 'fondbot:intent:list';
13
    protected $description = 'List all registered intents';
14
15
    private $conversationManager;
16
17
    public function __construct(ConversationManager $conversationManager)
18
    {
19
        parent::__construct();
20
21
        $this->conversationManager = $conversationManager;
22
    }
23
24
    public function handle(): void
25
    {
26
        $rows = collect($this->conversationManager->getIntents())
27
            ->transform(function ($item) {
28
                return [$item];
29
            })
30
            ->toArray();
31
32
        $this->table(['Class'], $rows);
33
    }
34
}
35