protected function _prepareEvent($eventName, array $data = [])
    {
        if (is_array($eventName)) {
            list($eventName, $subject) = $eventName;
        } else {
            $subject = new EventDispatcher();
        }

        return new Event($eventName, $subject, $data);
    }
protected function _prepareEvent($eventName, array $data = [])
    {
        if (is_array($eventName)) {
            list($eventName, $subject) = $eventName;
        } else {
            $subject = new EventDispatcher();
        }

        return new Event($eventName, $subject, $data);
    }
protected function _prepareEvent ( $ eventName , array $ data = [ ] ) { if ( is_array ( $ eventName ) ) { list ( $ eventName , $ subject ) = $ eventName ; } else { $ subject = new EventDispatcher ( ) ; } return new Event ( $ eventName , $ subject , $ data ) ; }
Prepares the event object to be triggered.

@param array|string $eventName The event name to trigger
@param array $data Data to be passed to event listener method
@return \Cake\Event\Event
Prepares the event object to be triggered .