original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: return event object or create it if not exist
  
  @param string $eventName
  @param array $data
  @return EventInterface
  @throws \LogicException
  @throws \InvalidArgumentException
docstring_tokens: return event object or create it if not exist