DetectAppointmentsChangingCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Wabel\CertainAPI\Commands;
4
5
6
use Symfony\Component\Console\Command\Command;
7
use Symfony\Component\Console\Input\InputArgument;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Output\OutputInterface;
10
use Wabel\CertainAPI\Services\DetectAppointmentsChangingsService;
11
12
class DetectAppointmentsChangingCommand extends Command
13
{
14
15
    /**
16
     * @var DetectAppointmentsChangingsService
17
     */
18
    private $detectAppointmentsChangingsService;
19
20
    /**
21
     * DetectAppointmentsChangingCommand constructor.
22
     * @param DetectAppointmentsChangingsService $detectAppointmentsChangingsService
23
     * @param string|null $name
24
     */
25
    public function __construct(DetectAppointmentsChangingsService $detectAppointmentsChangingsService, string $name = null)
26
    {
27
        parent::__construct($name);
28
        $this->detectAppointmentsChangingsService = $detectAppointmentsChangingsService;
29
    }
30
31
    protected function configure()
32
    {
33
        $this
34
            ->setName('certain:detect-changings')
35
            ->setDescription('Detect changings of appointments from  Certain Event.')
36
            ->setHelp(<<<EOT
37
Request Certain to get appointments and detect changes between to request
38
EOT
39
            );
40
        $this->addArgument('eventCode', InputArgument::REQUIRED, 'Specify the eventCode from Certain');
41
    }
42
43
    public function execute(InputInterface $input, OutputInterface $output)
44
    {
45
        $this->detectAppointmentsChangingsService->runCommandForEvent($input->getArgument('eventCode'), $output);
0 ignored issues
show
Bug introduced by
It seems like $input->getArgument('eventCode') targeting Symfony\Component\Consol...nterface::getArgument() can also be of type array<integer,string> or null; however, Wabel\CertainAPI\Service...e::runCommandForEvent() does only seem to accept string, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
46
    }
47
48
}
49