Completed
Push — master ( 3e3d3c...053aa5 )
by Olivier
01:44
created

SimpleDispatcher   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 17
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A dispatch() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the ICanBoogie package.
5
 *
6
 * (c) Olivier Laviale <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace ICanBoogie\MessageBus;
13
14
/**
15
 * A simple message dispatcher.
16
 */
17
class SimpleDispatcher implements Dispatcher
18
{
19
    /**
20
     * @var HandlerProvider
21
     */
22
    private $handlerProvider;
23
24
    public function __construct(HandlerProvider $handlerProvider)
25
    {
26
        $this->handlerProvider = $handlerProvider;
27
    }
28
29
    public function dispatch(object $message)
30
    {
31
        return $this->handlerProvider->getHandlerForMessage($message)($message);
32
    }
33
}
34