UpdateStreamCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 24
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 4 1
A __construct() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ProjetNormandie\TwitchBundle\Command;
6
7
use Exception;
8
use ProjetNormandie\TwitchBundle\Scheduler\Message\UpdateStream;
9
use Symfony\Component\Console\Attribute\AsCommand;
10
use Symfony\Component\Console\Command\Command;
11
use Symfony\Component\Console\Input\InputInterface;
12
use Symfony\Component\Console\Output\OutputInterface;
13
use Symfony\Component\Messenger\MessageBusInterface;
14
15
#[AsCommand(
16
    name: 'pn-twitch:update-stream',
17
    description: 'Check steams'
18
)]
19
class UpdateStreamCommand extends Command
20
{
21
22
    public function __construct(
23
        private readonly MessageBusInterface $bus
24
    ) {
25
        parent::__construct();
26
    }
27
28
29
    /**
30
     * @param InputInterface  $input
31
     * @param OutputInterface $output
32
     * @return int
33
     * @throws Exception
34
     */
35
    protected function execute(InputInterface $input, OutputInterface $output): int
36
    {
37
        $this->bus->dispatch(new UpdateStream());
38
        return Command::SUCCESS;
39
    }
40
}
41