private function resolveArgument($argument)
    {
        if (is_array($argument)) {
            return array_map(array($this, 'resolveArgument'), $argument);
        }

        if (!is_string($argument)) {
            return $argument;
        }

        $container = $this->kernel->getContainer();
        $container = $container->has('test.service_container') ? $container->get('test.service_container') : $container;

        if ($service = $this->getService($container, $argument)) {
            return $service;
        }

        $resolvedParam = $this->replaceParameters($container, $argument);

        if (!is_string($resolvedParam)) {
            return $resolvedParam;
        }

        return $this->escape($resolvedParam);
    }