AbstractEventQueue   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 4
c 1
b 0
f 0
dl 0
loc 29
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getSerializedEvent() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
/*
4
 * event-async (https://github.com/phpgears/event-async).
5
 * Async decorator for Event bus.
6
 *
7
 * @license MIT
8
 * @link https://github.com/phpgears/event-async
9
 * @author Julián Gutiérrez <[email protected]>
10
 */
11
12
declare(strict_types=1);
13
14
namespace Gears\Event\Async;
15
16
use Gears\Event\Async\Serializer\EventSerializer;
17
use Gears\Event\Event;
18
19
abstract class AbstractEventQueue implements EventQueue
20
{
21
    /**
22
     * Event serializer.
23
     *
24
     * @var EventSerializer
25
     */
26
    private $serializer;
27
28
    /**
29
     * AbstractEventQueue constructor.
30
     *
31
     * @param EventSerializer $serializer
32
     */
33
    public function __construct(EventSerializer $serializer)
34
    {
35
        $this->serializer = $serializer;
36
    }
37
38
    /**
39
     * Get serialized event.
40
     *
41
     * @param Event $event
42
     *
43
     * @return string
44
     */
45
    final protected function getSerializedEvent(Event $event): string
46
    {
47
        return $this->serializer->serialize($event);
48
    }
49
}
50