public static function trigger($class, $name, Event $event = null)
    {
        if (empty(static::$events)) {
            return;
        }
        if ($event === null) {
            $event = new static;
        }
        $event->handled = false;
        $event->name = $name;

        if (is_object($class)) {
            if ($event->owner === null) {
                $event->owner = $class;
            }
            $class = get_class($class);
        } else{
            $class = ltrim($class, '\\');
        }

        do {
            if (!empty(static::$events[$class][$name])) {
                foreach (static::$events[$class][$name] as $handler) {
                    call_user_func($handler, $event);
                    if ($event->handled) {
                        return;
                    }
                }
                //static::off($class, $name);
            }
        } while (($class = get_parent_class($class)) !== false);
    }