src/PAMI/Message/Event/Factory/Impl/EventFactoryImpl.php
public static function createFromRaw($message)
    {
        $eventStart = strpos($message, 'Event: ') + 7;
        $eventEnd = strpos($message, Message::EOL, $eventStart);
        if ($eventEnd === false) {
            $eventEnd = strlen($message);
        }
        $name = substr($message, $eventStart, $eventEnd - $eventStart);
        $parts = explode('_', $name);
        $totalParts = count($parts);
        for ($i = 0; $i < $totalParts; $i++) {
            $parts[$i] = ucfirst($parts[$i]);
        }
        $name = implode($parts, '');
        $className = '\\PAMI\\Message\\Event\\' . $name . 'Event';
        if (class_exists($className, true)) {
            return new $className($message);
        }
        return new UnknownEvent($message);
    }
public static function createFromRaw($message)
    {
        $eventStart = strpos($message, 'Event: ') + 7;
        $eventEnd = strpos($message, Message::EOL, $eventStart);
        if ($eventEnd === false) {
            $eventEnd = strlen($message);
        }
        $name = substr($message, $eventStart, $eventEnd - $eventStart);
        $parts = explode('_', $name);
        $totalParts = count($parts);
        for ($i = 0; $i < $totalParts; $i++) {
            $parts[$i] = ucfirst($parts[$i]);
        }
        $name = implode($parts, '');
        $className = '\\PAMI\\Message\\Event\\' . $name . 'Event';
        if (class_exists($className, true)) {
            return new $className($message);
        }
        return new UnknownEvent($message);
    }
public static function createFromRaw ( $ message ) { $ eventStart = strpos ( $ message , 'Event: ' ) + 7 ; $ eventEnd = strpos ( $ message , Message :: EOL , $ eventStart ) ; if ( $ eventEnd === false ) { $ eventEnd = strlen ( $ message ) ; } $ name = substr ( $ message , $ eventStart , $ eventEnd - $ eventStart ) ; $ parts = explode ( '_' , $ name ) ; $ totalParts = count ( $ parts ) ; for ( $ i = 0 ; $ i < $ totalParts ; $ i ++ ) { $ parts [ $ i ] = ucfirst ( $ parts [ $ i ] ) ; } $ name = implode ( $ parts , '' ) ; $ className = '\\PAMI\\Message\\Event\\' . $ name . 'Event' ; if ( class_exists ( $ className , true ) ) { return new $ className ( $ message ) ; } return new UnknownEvent ( $ message ) ; }
This is our factory method.

@param string $message Literall message as received from ami.

@return EventMessage
This is our factory method .