ScheduledCommandsDispatcher   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 27
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A run() 0 6 1
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
11
class ScheduledCommandsDispatcher
12
{
13
    /**
14
     * @var ScheduledCommandStore
15
     */
16
    private $store;
17
    /**
18
     * @var CommandDispatcher
19
     */
20
    private $dispatcher;
21
22 1
    public function __construct(
23
        ScheduledCommandStore $store,
24
        CommandDispatcher $dispatcher
25
    )
26
    {
27 1
        $this->store = $store;
28 1
        $this->dispatcher = $dispatcher;
29 1
    }
30
31
    public function run()
32
    {
33 1
        $this->store->loadAndProcessScheduledCommands(function (ScheduledCommand $scheduledCommand) {
34 1
            $this->dispatcher->dispatchCommand($scheduledCommand);
35 1
        });
36
    }
37
}