src/Event/Base/EventDispatcher.php
protected function createEventObject($eventName, array $data)
    {
        if (!array_key_exists($eventName, $this->options['events'])) {
            throw new \InvalidArgumentException('Event is not defined.');
        }

        $namespace = $this->options['events'][$eventName]['object'];
        $instance = new $namespace($eventName, $data);

        if (!($instance instanceof EventInterface)) {
            throw new \LogicException('Invalid interface of event object');
        }

        return $instance;
    }
protected function createEventObject($eventName, array $data)
    {
        if (!array_key_exists($eventName, $this->options['events'])) {
            throw new \InvalidArgumentException('Event is not defined.');
        }

        $namespace = $this->options['events'][$eventName]['object'];
        $instance = new $namespace($eventName, $data);

        if (!($instance instanceof EventInterface)) {
            throw new \LogicException('Invalid interface of event object');
        }

        return $instance;
    }
protected function createEventObject ( $ eventName , array $ data ) { if ( ! array_key_exists ( $ eventName , $ this -> options [ 'events' ] ) ) { throw new \ InvalidArgumentException ( 'Event is not defined.' ) ; } $ namespace = $ this -> options [ 'events' ] [ $ eventName ] [ 'object' ] ; $ instance = new $ namespace ( $ eventName , $ data ) ; if ( ! ( $ instance instanceof EventInterface ) ) { throw new \ LogicException ( 'Invalid interface of event object' ) ; } return $ instance ; }
return event object or create it if not exist

@param string $eventName
@param array $data
@return EventInterface
@throws \LogicException
@throws \InvalidArgumentException
return event object or create it if not exist