Completed
Push — master ( 7b5328...a0ddef )
by Park Jong-Hun
02:40
created

ControllerEvent   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 1
dl 0
loc 16
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A triggerEvent() 0 4 1
A getEventName() 0 4 1
1
<?php
2
3
namespace Core\ControllerDispatcher;
4
5
use Core\Event\EventManager;
6
7
class ControllerEvent
8
{
9
    public static function triggerEvent($controller, $action, array $parameter)
10
    {
11
        EventManager::getEventManager()->trigger(self::getEventName($controller, $action), $parameter);
12
    }
13
14
    /**
15
     * @param  string $action 'before' || 'after'
16
     * @return string event name
17
     */
18
    private static function getEventName($controller, $action)
19
    {
20
        return sprintf('Controller.%s.%s', $controller, $action);
21
    }
22
}
23