Completed
Push — master ( c497f7...2066be )
by Greg
02:05
created

CustomEventAwareTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 1
cbo 0
dl 0
loc 24
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setHookManager() 0 4 1
A getCustomEventHandlers() 0 7 2
1
<?php
2
namespace Consolidation\AnnotatedCommand\Events;
3
4
use Consolidation\AnnotatedCommand\Hooks\HookManager;
5
6
trait CustomEventAwareTrait
7
{
8
    /** var HookManager */
9
    protected $hookManager;
10
11
    /**
12
     * {@inheritdoc}
13
     */
14
    public function setHookManager(HookManager $hookManager)
15
    {
16
        $this->hookManager = $hookManager;
17
    }
18
19
    /**
20
     * {@inheritdoc}
21
     */
22
    public function getCustomEventHandlers($eventName)
23
    {
24
        if (!$this->hookManager) {
25
            return [];
26
        }
27
        return $this->hookManager->getHook($eventName, HookManager::ON_EVENT);
28
    }
29
}
30