protected function createUrlStatements(Operation $operation, $queryParamVariable)
    {
        $urlVariable = new Expr\Variable('url');
        // url = /path
        $statements = [
            new Expr\Assign($urlVariable, new Scalar\String_($operation->getPath()))
        ];

        if ($operation->getOperation()->getParameters()) {
            foreach ($operation->getOperation()->getParameters() as $parameter) {
                if ($parameter instanceof Reference) {
                    $parameter = $this->resolveParameter($parameter);
                }

                if ($parameter instanceof PathParameterSubSchema) {
                    // $url = str_replace('{param}', $param, $url)
                    $statements[] = new Expr\Assign($urlVariable, new Expr\FuncCall(new Name('str_replace'), [
                        new Arg(new Scalar\String_('{' . $parameter->getName() . '}')),
                        new Arg(new Expr\FuncCall(new Name('urlencode'), [
                            new Arg(new Expr\Variable(Inflector::camelize($parameter->getName()))),
                        ])),
                        new Arg($urlVariable)
                    ]));
                }
            }
        }

        // url = url . ? . $queryParam->buildQueryString
        $statements[] = new Expr\Assign($urlVariable, new Expr\BinaryOp\Concat(
            $urlVariable,
            new Expr\BinaryOp\Concat(
                new Scalar\String_('?'),
                new Expr\MethodCall($queryParamVariable, 'buildQueryString', [new Arg(new Expr\Variable('parameters'))])
            )
        ));

        return [$statements, $urlVariable];
    }