Completed
Push — master ( be9660...707803 )
by Georges
16s queued 13s
created

EventManagerDispatcherTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 32
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setEventManager() 0 5 1
A hasEventManager() 0 3 1
A getEventManager() 0 3 1
1
<?php
2
/**
3
 *
4
 * This file is part of phpFastCache.
5
 *
6
 * @license MIT License (MIT)
7
 *
8
 * For full copyright and license information, please see the docs/CREDITS.txt file.
9
 *
10
 * @author Khoa Bui (khoaofgod)  <[email protected]> https://www.phpfastcache.com
11
 * @author Georges.L (Geolim4)  <[email protected]>
12
 *
13
 */
14
15
declare(strict_types=1);
16
17
namespace Phpfastcache\Event;
18
19
/**
20
 * Interface EventInterface
21
 * @package Phpfastcache\Event
22
 */
23
trait EventManagerDispatcherTrait
24
{
25
    /**
26
     * @var EventManagerInterface
27
     */
28
    protected $eventManager;
29
30
    /**
31
     * @return EventManagerInterface
32
     */
33
    public function getEventManager(): EventManagerInterface
34
    {
35
        return $this->eventManager;
36
    }
37
38
    /**
39
     * @param EventManagerInterface $em
40
     * @return EventManagerDispatcherInterface
41
     */
42
    public function setEventManager(EventManagerInterface $em): EventManagerDispatcherInterface
43
    {
44
        $this->eventManager = $em;
45
46
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Phpfastcache\Event\EventManagerDispatcherTrait which is incompatible with the type-hinted return Phpfastcache\Event\EventManagerDispatcherInterface.
Loading history...
47
    }
48
49
    /**
50
     * @return bool
51
     */
52
    public function hasEventManager(): bool
53
    {
54
        return isset($this->eventManager);
55
    }
56
}