Skip to content

Commit ea637ba

Browse files
committed
used event name instead of the class name for dispatching events
1 parent 2b725af commit ea637ba

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/mg/AsterTrace/Handlers/PamiHandler.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,8 @@ public function handlePamiEvent(\PAMI\Message\Event\EventMessage $event)
8686
// First, dispatch the event to all generic event listeners
8787
$this->container->eventDispatch('anyEvent', $event);
8888

89-
// Get the class of the event, something like PAMI\Message\Event\SomeEvent.
90-
$eventClass = get_class($event);
91-
92-
// Get to the last \ and copy from there.
93-
$eventName = substr($eventClass, strrpos($eventClass, '\\') + 1);
94-
95-
// Strip "Event" from the end of the string and lowercase the first letter.
96-
$eventName = lcfirst(substr($eventName, 0, -5));
97-
9889
// After all of this, the resulting event name will be "some".
90+
$eventName = lcfirst($event->getName());
9991
if (method_exists($event, 'getSubEvent')) {
10092
// If this event has a subevent string, then concatenate it to the
10193
// event name, like someSubEvent.

0 commit comments

Comments
 (0)