Completed
Push — master ( c5110b...a167e6 )
by Valentyn
13:46
created

RunReleaseDateQueue::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 2
1
<?php
2
3
namespace App\Movies\Command;
4
5
use App\Movies\Service\ReleaseDateService;
6
use Symfony\Component\Console\Command\Command;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
class RunReleaseDateQueue extends Command
11
{
12
    private $releaseDateService;
13
14
    public function __construct(ReleaseDateService $releaseDateService, ?string $name = null)
15
    {
16
        parent::__construct($name);
17
18
        $this->releaseDateService = $releaseDateService;
19
    }
20
21
    protected function configure()
22
    {
23
        $this
24
            ->setName('app:run-release-date-queue')
25
            ->setDescription('Check new release dates')
26
            ->setHelp('This command will search for new release dates on resources like imdb and tmdb');
27
    }
28
29
    protected function execute(InputInterface $input, OutputInterface $output)
30
    {
31
        $output->writeln(sprintf('Queue started at %s', \date('d-m-Y h:i:s')));
32
        $this->releaseDateService->runCheck();
33
        $output->writeln(sprintf('Queue ended at %s', \date('d-m-Y h:i:s')));
34
    }
35
}
36