code: protected function createBodyStatements(Operation $operation, $queryParamVariable, Context $context)
      {
          $bodyParameter = null;
          $bodyVariable = new Expr\Variable('body');
          $parameterKey = 0;
  
          if ($operation->getOperation()->getParameters()) {
              foreach ($operation->getOperation()->getParameters() as $key => $parameter) {
                  if ($parameter instanceof BodyParameter) {
                      $bodyParameter = $parameter;
                      $parameterKey = $key;
                  }
              }
          }
  
          if (null === $bodyParameter) {
              // $body = $queryParam->buildFormDataString($parameters);
              return [[
                  new Expr\Assign($bodyVariable, new Expr\MethodCall($queryParamVariable, 'buildFormDataString', [new Arg(new Expr\Variable('parameters'))]))
              ], $bodyVariable];
          }
  
          // $body = $this->serializer->serialize($parameter);
          if ($bodyParameter->getSchema() instanceof Reference || $context->getRegistry()->hasClass($operation->getReference() . '/parameters/' . $parameterKey)) {
              return [
                  [
                      new Expr\Assign(
                          $bodyVariable,
                          new Expr\MethodCall(
                              new Expr\PropertyFetch(new Expr\Variable('this'), 'serializer'),
                              'serialize',
                              [
                                  new Arg(new Expr\Variable(Inflector::camelize($bodyParameter->getName()))),
                                  new Arg(new Scalar\String_('json'))
                              ]
                          )
                      )
                  ],
                  $bodyVariable
              ];
          }
  
          // $body = $parameter
          return [[
              new Expr\Assign($bodyVariable, new Expr\Variable(Inflector::camelize($bodyParameter->getName())))
          ], $bodyVariable];
      }
docs: Create body statements
  
  @param Operation $operation
  @param Expr\Variable $queryParamVariable
  @param Context $context
  
  @return array