Test Failed
Push — master ( 4321c6...27997e )
by Constantin
05:35
created

ScheduledCommandsDispatcher::run()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
/******************************************************************************
3
 * Copyright (c) 2016 Constantin Galbenu <[email protected]>             *
4
 ******************************************************************************/
5
6
namespace Gica\Cqrs\Scheduling;
7
8
9
use Gica\Cqrs\Command\CommandDispatcher;
10
use Gica\Cqrs\ScheduledCommandStore;
11
12
class ScheduledCommandsDispatcher
13
{
14
    /**
15
     * @var ScheduledCommandStore
16
     */
17
    private $store;
18
    /**
19
     * @var CommandDispatcher
20
     */
21
    private $dispatcher;
22
23
    public function __construct(
24
        ScheduledCommandStore $store,
25
        CommandDispatcher $dispatcher
26
    )
27
    {
28
        $this->store = $store;
29
        $this->dispatcher = $dispatcher;
30
    }
31
32
    public function run()
33
    {
34
        $this->store->loadAndProcessScheduledCommands(function (ScheduledCommand $scheduledCommand) {
35
36
            $this->dispatcher->dispatchCommand($scheduledCommand);
37
38
        });
39
    }
40
}