PurgeCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 9
c 0
b 0
f 0
dl 0
loc 27
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A execute() 0 4 1
A configure() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ProjetNormandie\MessageBundle\Command;
6
7
use ProjetNormandie\MessageBundle\Repository\MessageRepository;
8
use Symfony\Component\Console\Command\Command;
9
use Symfony\Component\Console\Input\InputInterface;
10
use Symfony\Component\Console\Output\OutputInterface;
11
12
class PurgeCommand extends Command
13
{
14
    private MessageRepository $messageRepository;
15
16
    public function __construct(MessageRepository $messageRepository)
17
    {
18
        $this->messageRepository = $messageRepository;
19
        parent::__construct();
20
    }
21
22
    protected function configure(): void
23
    {
24
        $this
25
            ->setName('pn-message:purge')
26
            ->setDescription('Delete old messages')
27
        ;
28
    }
29
30
    /**
31
     * @param InputInterface  $input
32
     * @param OutputInterface $output
33
     * @return int
34
     */
35
    protected function execute(InputInterface $input, OutputInterface $output): int
36
    {
37
        $this->messageRepository->purge();
38
        return 0;
39
    }
40
}
41