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

ControllerEvent::triggerEvent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 3
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