public static function countHandlers($class, $name)
    {
        $class = ObjectHelper::getClass($class);
        $count = 0;

        do {
            if (!empty(self::$events[$class][$name])) {
                $count += count(static::$events[$class][$name]);
            }
        } while (($class = get_parent_class($class)) !== false);

        return $count;
    }