public function trigger($name, Event $event = null)
    {
        if (! isset($event)) {
            $event = new Event($this->subject);
        }
        if (isset($this->parent)) {
            if (! $this->parent->trigger($this->subjectClass . '.' . $name, $event)) {
                return false;
            }
        }
        if (isset($this->events[$name])) {
            $event->name = $name;
            foreach ($this->events[$name] as $function) {
                $continue = call_user_func($function, $event);
                if ($event->stopped or $continue === false) {
                    return false;
                }
            }
        } elseif (strpos($name, '.') === false) {
            throw new InvalidEventException(
                'Event subject "' . $this->subjectClass
                . '" does not have event "' . $name . '"'
            );
        }
        return true;
    }