Passed
Push — dev ( eeaa0f...91a85a )
by Janko
26:10
created

EventSchedulerCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 24
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 8 1
A __construct() 0 11 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Component\Cli;
6
7
use Ahc\Cli\Input\Command;
8
use Psr\Container\ContainerInterface;
9
use Stu\Component\Event\EventSchedulerInterface;
10
11
/**
12
 * Provides cli method for manual event scheduling
13
 */
14
final class EventSchedulerCommand extends Command
15
{
16
    public function __construct(
17
        private ContainerInterface $dic
18
    ) {
19
        parent::__construct(
20
            'event:schedule',
21
            'Runs the event scheduler'
22
        );
23
24
        $this
25
            ->usage(
26
                '<bold>  $0 event:schedule</end> <comment></end> ## Runs the event scheduler<eol/>'
27
            );
28
    }
29
30
    public function execute(): void
31
    {
32
        $eventScheduler = $this->dic->get(EventSchedulerInterface::class);
33
        $eventScheduler->processEvents();
34
35
        $this->io()->ok(
36
            'Event Scheduler has been executed',
37
            true
38
        );
39
    }
40
}
41