Receiver   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 34
ccs 5
cts 5
cp 1
rs 10
c 1
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
handle() 0 1 ?
A __invoke() 0 4 1
1
<?php
2
3
namespace League\Tactician\Bernard;
4
5
use Bernard\Message;
6
use League\Tactician\CommandBus;
7
8
/**
9
 * Receives a Message from a Consumer
10
 */
11
abstract class Receiver
12
{
13
    /**
14
     * @var CommandBus
15
     */
16
    protected $commandBus;
17
18
    /**
19
     * @param CommandBus $commandBus
20
     */
21 8
    public function __construct(CommandBus $commandBus)
22
    {
23 8
        $this->commandBus = $commandBus;
24 8
    }
25
26
    /**
27
     * Handles the message
28
     *
29
     * @param Message $message
30
     */
31
    abstract public function handle(Message $message);
32
33
    /**
34
     * Makes the receiver callable to be able to register it in a router
35
     *
36
     * @param Message $message
37
     *
38
     * @return mixed
39
     */
40 2
    public function __invoke(Message $message)
41
    {
42 2
        return $this->handle($message);
43
    }
44
}
45