public function getArguments(Request $request, array $controller, array $matched)
    {
        $reflection = new \ReflectionMethod($controller[0], $controller[1]);
        $attributes = $request->attributes->all();
        $arguments  = [];

        foreach ($reflection->getParameters() as $param) {
            if (array_key_exists($param->name, $matched)) {
                $arguments[] = $matched[$param->name];
            } elseif (array_key_exists($param->name, $attributes)) {
                $arguments[] = $attributes[$param->name];
            } elseif ($param->isDefaultValueAvailable()) {
                $arguments[] = $param->getDefaultValue();
            } else {
                $controller = sprintf('%s::%s()', get_class($controller[0]), $controller[1]);
                throw new \RuntimeException(sprintf('Controller "%s" requires that you provide a value for the "$%s" argument (either because there is no default value, or because there is a non-optional argument after this one).', $controller, $param->name));
            }
        }

        return $arguments;
    }