public function applyDefaults($definition)
    {
        if (!is_array($definition)) {
            return $definition;
        }

        if (!isset($definition['component'])) {
            throw new AppException('Missing required "component" key in listener definition');
        }

        return array_merge($this->defaults, $definition);
    }