public function buildDefinition($definition)
    {
        if (is_callable($definition)) {
            return $definition;
        }

        if (is_array($definition) && isset($definition['component'])) {
            return new Listener(
                $definition['component'],
                $definition['method'] ?: null,
                $definition['arguments'] ? (array) $definition['arguments'] : []
            );
        }

        throw new AppException('Invalid listener format, must be callable or array with component key');
    }