Completed
Push — master ( e03155...588b6d )
by Park Jong-Hun
03:05
created

EventManager::getEventManager()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 2
eloc 5
nc 2
nop 0
1
<?php
2
3
namespace Core;
4
5
use JBZoo\Event\EventManager as ZooEventManager;
6
7
class EventManager
8
{
9
    private $config = [];
0 ignored issues
show
Unused Code introduced by
The property $config is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
10
11
    private function __construct()
12
    {
13
    }
14
15
    /**
16
     * @return self
17
     */
18
    public static function getInstance()
19
    {
20
        static $instance = null;
21
22
        if ($instance === null) {
23
            $instance = new self();
24
        }
25
26
        return $instance;
27
    }
28
29
    public function registerListener(array $eventListeners)
30
    {
31
        $register = new EventListenerRegister();
32
        $register->setEventListener($eventListeners);
33
        $register->register();
34
    }
35
36
    /**
37
     * @return ZooEventManager
38
     */
39
    public function getEventManager()
40
    {
41
        static $instance = null;
42
43
        if ($instance === null) {
44
            $instance = new ZooEventManager();
45
        }
46
47
        return $instance;
48
    }
49
}
50