PurgeCommand::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 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