diff --git a/bin/configs/php-nextgen-echo-api.yaml b/bin/configs/php-nextgen-echo-api.yaml
new file mode 100644
index 00000000000..ada80ba4700
--- /dev/null
+++ b/bin/configs/php-nextgen-echo-api.yaml
@@ -0,0 +1,6 @@
+generatorName: php-nextgen
+outputDir: samples/client/echo_api/php-nextgen
+inputSpec: modules/openapi-generator/src/test/resources/3_0/echo_api.yaml
+templateDir: modules/openapi-generator/src/main/resources/php-nextgen
+additionalProperties:
+ hideGenerationTimestamp: "true"
diff --git a/bin/configs/php-nextgen.yaml b/bin/configs/php-nextgen.yaml
index 50d05c086ef..e8db9d729c2 100644
--- a/bin/configs/php-nextgen.yaml
+++ b/bin/configs/php-nextgen.yaml
@@ -1,4 +1,4 @@
generatorName: php-nextgen
outputDir: samples/client/petstore/php-nextgen/OpenAPIClient-php
-inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
+inputSpec: modules/openapi-generator/src/test/resources/3_0/php-nextgen/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/php-nextgen
diff --git a/modules/openapi-generator/src/test/resources/3_0/php-nextgen/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/3_0/php-nextgen/petstore-with-fake-endpoints-models-for-testing.yaml
new file mode 100644
index 00000000000..746d1be1134
--- /dev/null
+++ b/modules/openapi-generator/src/test/resources/3_0/php-nextgen/petstore-with-fake-endpoints-models-for-testing.yaml
@@ -0,0 +1,1999 @@
+openapi: 3.0.0
+info:
+ description: >-
+ This spec is mainly for testing Petstore server and contains fake endpoints,
+ models. Please do not use this for any other purpose. Special characters: "
+ \
+ version: 1.0.0
+ title: OpenAPI Petstore
+ license:
+ name: Apache-2.0
+ url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
+tags:
+ - name: pet
+ description: Everything about your Pets
+ - name: store
+ description: Access to Petstore orders
+ - name: user
+ description: Operations about user
+paths:
+ /foo:
+ get:
+ responses:
+ default:
+ description: response
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ string:
+ $ref: '#/components/schemas/Foo'
+ /pet:
+ servers:
+ - url: 'http://petstore.swagger.io/v2'
+ - url: 'http://path-server-test.petstore.local/v2'
+ - url: 'http://{server}.swagger.io:{port}/v2'
+ description: test server with variables
+ variables:
+ server:
+ description: target server
+ enum:
+ - 'petstore'
+ - 'qa-petstore'
+ - 'dev-petstore'
+ default: 'petstore'
+ port:
+ enum:
+ - 80
+ - 8080
+ default: 80
+ post:
+ tags:
+ - pet
+ summary: Add a new pet to the store
+ description: ''
+ operationId: addPet
+ responses:
+ '200':
+ description: Successful operation
+ '405':
+ description: Invalid input
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ requestBody:
+ $ref: '#/components/requestBodies/Pet'
+ put:
+ tags:
+ - pet
+ summary: Update an existing pet
+ description: ''
+ operationId: updatePet
+ x-webclient-blocking: true
+ responses:
+ '200':
+ description: Successful operation
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ '405':
+ description: Validation exception
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ requestBody:
+ $ref: '#/components/requestBodies/Pet'
+ /pet/findByStatus:
+ get:
+ tags:
+ - pet
+ summary: Finds Pets by status
+ description: Multiple status values can be provided with comma separated strings
+ operationId: findPetsByStatus
+ x-webclient-blocking: true
+ parameters:
+ - name: status
+ in: query
+ description: Status values that need to be considered for filter
+ required: true
+ style: form
+ explode: false
+ deprecated: true
+ schema:
+ type: array
+ items:
+ type: string
+ enum:
+ - available
+ - pending
+ - sold
+ default: available
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ '400':
+ description: Invalid status value
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ /pet/findByTags:
+ get:
+ tags:
+ - pet
+ summary: Finds Pets by tags
+ description: >-
+ Multiple tags can be provided with comma separated strings. Use tag1,
+ tag2, tag3 for testing.
+ operationId: findPetsByTags
+ x-webclient-blocking: true
+ parameters:
+ - name: tags
+ in: query
+ description: Tags to filter by
+ required: true
+ style: form
+ explode: false
+ schema:
+ type: array
+ items:
+ type: string
+ uniqueItems: true
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ uniqueItems: true
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ uniqueItems: true
+ '400':
+ description: Invalid tag value
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ deprecated: true
+ '/pet/{petId}':
+ get:
+ tags:
+ - pet
+ summary: Find pet by ID
+ description: Returns a single pet
+ operationId: getPetById
+ x-webclient-blocking: true
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet to return
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ security:
+ - api_key: []
+ post:
+ tags:
+ - pet
+ summary: Updates a pet in the store with form data
+ description: ''
+ operationId: updatePetWithForm
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet that needs to be updated
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ '200':
+ description: Successful operation
+ '405':
+ description: Invalid input
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ requestBody:
+ content:
+ application/x-www-form-urlencoded:
+ schema:
+ type: object
+ properties:
+ name:
+ description: Updated name of the pet
+ type: string
+ status:
+ description: Updated status of the pet
+ type: string
+ delete:
+ tags:
+ - pet
+ summary: Deletes a pet
+ description: ''
+ operationId: deletePet
+ parameters:
+ - name: api_key
+ in: header
+ required: false
+ schema:
+ type: string
+ - name: petId
+ in: path
+ description: Pet id to delete
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ '200':
+ description: Successful operation
+ '400':
+ description: Invalid pet value
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ '/pet/{petId}/uploadImage':
+ post:
+ tags:
+ - pet
+ summary: uploads an image
+ description: ''
+ operationId: uploadFile
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet to update
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ requestBody:
+ content:
+ multipart/form-data:
+ schema:
+ type: object
+ properties:
+ additionalMetadata:
+ description: Additional data to pass to server
+ type: string
+ file:
+ description: file to upload
+ type: string
+ format: binary
+ /store/inventory:
+ get:
+ tags:
+ - store
+ summary: Returns pet inventories by status
+ description: Returns a map of status codes to quantities
+ operationId: getInventory
+ x-webclient-blocking: false
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/json:
+ schema:
+ type: object
+ additionalProperties:
+ type: integer
+ format: int32
+ security:
+ - api_key: []
+ /store/order:
+ post:
+ tags:
+ - store
+ summary: Place an order for a pet
+ description: ''
+ operationId: placeOrder
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Order'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Order'
+ '400':
+ description: Invalid Order
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Order'
+ description: order placed for purchasing the pet
+ required: true
+ '/store/order/{order_id}':
+ get:
+ tags:
+ - store
+ summary: Find purchase order by ID
+ description: >-
+ For valid response try integer IDs with value <= 5 or > 10. Other values
+ will generate exceptions
+ operationId: getOrderById
+ parameters:
+ - name: order_id
+ in: path
+ description: ID of pet that needs to be fetched
+ required: true
+ schema:
+ type: integer
+ format: int64
+ minimum: 1
+ maximum: 5
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Order'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Order'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Order not found
+ delete:
+ tags:
+ - store
+ summary: Delete purchase order by ID
+ description: >-
+ For valid response try integer IDs with value < 1000. Anything above
+ 1000 or nonintegers will generate API errors
+ operationId: deleteOrder
+ parameters:
+ - name: order_id
+ in: path
+ description: ID of the order that needs to be deleted
+ required: true
+ schema:
+ type: string
+ responses:
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Order not found
+ /user:
+ post:
+ tags:
+ - user
+ summary: Create user
+ description: This can only be done by the logged in user.
+ operationId: createUser
+ responses:
+ default:
+ description: successful operation
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ description: Created user object
+ required: true
+ /user/createWithArray:
+ post:
+ tags:
+ - user
+ summary: Creates list of users with given input array
+ description: ''
+ operationId: createUsersWithArrayInput
+ responses:
+ default:
+ description: successful operation
+ requestBody:
+ $ref: '#/components/requestBodies/UserArray'
+ /user/createWithList:
+ post:
+ tags:
+ - user
+ summary: Creates list of users with given input array
+ description: ''
+ operationId: createUsersWithListInput
+ responses:
+ default:
+ description: successful operation
+ requestBody:
+ $ref: '#/components/requestBodies/UserArray'
+ /user/login:
+ get:
+ tags:
+ - user
+ summary: Logs user into the system
+ description: ''
+ operationId: loginUser
+ parameters:
+ - name: username
+ in: query
+ description: The user name for login
+ required: true
+ schema:
+ type: string
+ - name: password
+ in: query
+ description: The password for login in clear text
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: successful operation
+ headers:
+ X-Rate-Limit:
+ description: calls per hour allowed by the user
+ schema:
+ type: integer
+ format: int32
+ X-Expires-After:
+ description: date in UTC when token expires
+ schema:
+ type: string
+ format: date-time
+ content:
+ application/xml:
+ schema:
+ type: string
+ application/json:
+ schema:
+ type: string
+ '400':
+ description: Invalid username/password supplied
+ /user/logout:
+ get:
+ tags:
+ - user
+ summary: Logs out current logged in user session
+ description: ''
+ operationId: logoutUser
+ responses:
+ default:
+ description: successful operation
+ '/user/{username}':
+ get:
+ tags:
+ - user
+ summary: Get user by user name
+ description: ''
+ operationId: getUserByName
+ parameters:
+ - name: username
+ in: path
+ description: The name that needs to be fetched. Use user1 for testing.
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/User'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ '400':
+ description: Invalid username supplied
+ '404':
+ description: User not found
+ put:
+ tags:
+ - user
+ summary: Updated user
+ description: This can only be done by the logged in user.
+ operationId: updateUser
+ parameters:
+ - name: username
+ in: path
+ description: name that need to be deleted
+ required: true
+ schema:
+ type: string
+ responses:
+ '400':
+ description: Invalid user supplied
+ '404':
+ description: User not found
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ description: Updated user object
+ required: true
+ delete:
+ tags:
+ - user
+ summary: Delete user
+ description: This can only be done by the logged in user.
+ operationId: deleteUser
+ parameters:
+ - name: username
+ in: path
+ description: The name that needs to be deleted
+ required: true
+ schema:
+ type: string
+ responses:
+ '400':
+ description: Invalid username supplied
+ '404':
+ description: User not found
+ /fake_classname_test:
+ patch:
+ tags:
+ - 'fake_classname_tags 123#$%^'
+ summary: To test class name in snake case
+ description: To test class name in snake case
+ operationId: testClassname
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Client'
+ security:
+ - api_key_query: []
+ requestBody:
+ $ref: '#/components/requestBodies/Client'
+ /fake:
+ patch:
+ tags:
+ - fake
+ summary: To test "client" model
+ description: To test "client" model
+ operationId: testClientModel
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Client'
+ requestBody:
+ $ref: '#/components/requestBodies/Client'
+ get:
+ tags:
+ - fake
+ summary: To test enum parameters
+ description: To test enum parameters
+ operationId: testEnumParameters
+ parameters:
+ - name: enum_header_string_array
+ in: header
+ description: Header parameter enum test (string array)
+ schema:
+ type: array
+ items:
+ type: string
+ default: $
+ enum:
+ - '>'
+ - $
+ - name: enum_header_string
+ in: header
+ description: Header parameter enum test (string)
+ schema:
+ type: string
+ enum:
+ - _abc
+ - '-efg'
+ - (xyz)
+ default: '-efg'
+ - name: enum_query_string_array
+ in: query
+ description: Query parameter enum test (string array)
+ schema:
+ type: array
+ items:
+ type: string
+ default: $
+ enum:
+ - '>'
+ - $
+ - name: enum_query_string
+ in: query
+ description: Query parameter enum test (string)
+ schema:
+ type: string
+ enum:
+ - _abc
+ - '-efg'
+ - (xyz)
+ default: '-efg'
+ - name: enum_query_integer
+ in: query
+ description: Query parameter enum test (double)
+ schema:
+ type: integer
+ format: int32
+ enum:
+ - 1
+ - -2
+ - name: enum_query_double
+ in: query
+ description: Query parameter enum test (double)
+ schema:
+ type: number
+ format: double
+ enum:
+ - 1.1
+ - -1.2
+ - name: enum_query_model_array
+ in: query
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/EnumClass'
+ responses:
+ '400':
+ description: Invalid request
+ '404':
+ description: Not found
+ requestBody:
+ content:
+ application/x-www-form-urlencoded:
+ schema:
+ type: object
+ properties:
+ enum_form_string_array:
+ description: Form parameter enum test (string array)
+ type: array
+ items:
+ type: string
+ default: $
+ enum:
+ - '>'
+ - $
+ enum_form_string:
+ description: Form parameter enum test (string)
+ type: string
+ enum:
+ - _abc
+ - '-efg'
+ - (xyz)
+ default: '-efg'
+ post:
+ tags:
+ - fake
+ summary: |
+ Fake endpoint for testing various parameters
+ 假端點
+ 偽のエンドポイント
+ 가짜 엔드 포인트
+ description: |
+ Fake endpoint for testing various parameters
+ 假端點
+ 偽のエンドポイント
+ 가짜 엔드 포인트
+ operationId: testEndpointParameters
+ responses:
+ '400':
+ description: Invalid username supplied
+ '404':
+ description: User not found
+ security:
+ - http_basic_test: []
+ requestBody:
+ content:
+ application/x-www-form-urlencoded:
+ schema:
+ type: object
+ properties:
+ integer:
+ description: None
+ type: integer
+ minimum: 10
+ maximum: 100
+ int32:
+ description: None
+ type: integer
+ format: int32
+ minimum: 20
+ maximum: 200
+ int64:
+ description: None
+ type: integer
+ format: int64
+ number:
+ description: None
+ type: number
+ minimum: 32.1
+ maximum: 543.2
+ float:
+ description: None
+ type: number
+ format: float
+ maximum: 987.6
+ double:
+ description: None
+ type: number
+ format: double
+ minimum: 67.8
+ maximum: 123.4
+ string:
+ description: None
+ type: string
+ pattern: '/[a-z]/i'
+ pattern_without_delimiter:
+ description: None
+ type: string
+ pattern: '^[A-Z].*'
+ byte:
+ description: None
+ type: string
+ format: byte
+ binary:
+ description: None
+ type: string
+ format: binary
+ date:
+ description: None
+ type: string
+ format: date
+ dateTime:
+ description: None
+ type: string
+ format: date-time
+ password:
+ description: None
+ type: string
+ format: password
+ minLength: 10
+ maxLength: 64
+ callback:
+ description: None
+ type: string
+ required:
+ - number
+ - double
+ - pattern_without_delimiter
+ - byte
+ delete:
+ tags:
+ - fake
+ security:
+ - bearer_test: []
+ summary: Fake endpoint to test group parameters (optional)
+ description: Fake endpoint to test group parameters (optional)
+ operationId: testGroupParameters
+ x-group-parameters: true
+ parameters:
+ - name: required_string_group
+ in: query
+ description: Required String in group parameters
+ required: true
+ schema:
+ type: integer
+ - name: required_boolean_group
+ in: header
+ description: Required Boolean in group parameters
+ required: true
+ schema:
+ type: boolean
+ - name: required_int64_group
+ in: query
+ description: Required Integer in group parameters
+ required: true
+ schema:
+ type: integer
+ format: int64
+ - name: string_group
+ in: query
+ description: String in group parameters
+ schema:
+ type: integer
+ - name: boolean_group
+ in: header
+ description: Boolean in group parameters
+ schema:
+ type: boolean
+ - name: int64_group
+ in: query
+ description: Integer in group parameters
+ schema:
+ type: integer
+ format: int64
+ responses:
+ '400':
+ description: Something wrong
+ /fake/outer/number:
+ post:
+ tags:
+ - fake
+ description: Test serialization of outer number types
+ operationId: fakeOuterNumberSerialize
+ responses:
+ '200':
+ description: Output number
+ content:
+ '*/*':
+ schema:
+ $ref: '#/components/schemas/OuterNumber'
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/OuterNumber'
+ description: Input number as post body
+ /fake/property/enum-int:
+ post:
+ tags:
+ - fake
+ description: Test serialization of enum (int) properties with examples
+ operationId: fakePropertyEnumIntegerSerialize
+ responses:
+ '200':
+ description: Output enum (int)
+ content:
+ '*/*':
+ schema:
+ $ref: '#/components/schemas/OuterObjectWithEnumProperty'
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/OuterObjectWithEnumProperty'
+ description: Input enum (int) as post body
+ /fake/outer/string:
+ post:
+ tags:
+ - fake
+ description: Test serialization of outer string types
+ operationId: fakeOuterStringSerialize
+ responses:
+ '200':
+ description: Output string
+ content:
+ '*/*':
+ schema:
+ $ref: '#/components/schemas/OuterString'
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/OuterString'
+ description: Input string as post body
+ /fake/outer/boolean:
+ post:
+ tags:
+ - fake
+ description: Test serialization of outer boolean types
+ operationId: fakeOuterBooleanSerialize
+ responses:
+ '200':
+ description: Output boolean
+ content:
+ '*/*':
+ schema:
+ $ref: '#/components/schemas/OuterBoolean'
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/OuterBoolean'
+ description: Input boolean as post body
+ /fake/outer/composite:
+ post:
+ tags:
+ - fake
+ description: Test serialization of object with outer number type
+ operationId: fakeOuterCompositeSerialize
+ responses:
+ '200':
+ description: Output composite
+ content:
+ '*/*':
+ schema:
+ $ref: '#/components/schemas/OuterComposite'
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/OuterComposite'
+ description: Input composite as post body
+ /fake/BigDecimalMap:
+ get:
+ tags:
+ - fake
+ description: for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys
+ operationId: fakeBigDecimalMap
+ responses:
+ '200':
+ description: successful operation
+ content:
+ '*/*':
+ schema:
+ type: object
+ properties:
+ someId:
+ type: number
+ someMap:
+ type: object
+ additionalProperties:
+ type: number
+ /fake/jsonFormData:
+ get:
+ tags:
+ - fake
+ summary: test json serialization of form data
+ description: ''
+ operationId: testJsonFormData
+ responses:
+ '200':
+ description: successful operation
+ requestBody:
+ content:
+ application/x-www-form-urlencoded:
+ schema:
+ type: object
+ properties:
+ param:
+ description: field1
+ type: string
+ param2:
+ description: field2
+ type: string
+ required:
+ - param
+ - param2
+ /fake/inline-additionalProperties:
+ post:
+ tags:
+ - fake
+ summary: test inline additionalProperties
+ description: ''
+ operationId: testInlineAdditionalProperties
+ responses:
+ '200':
+ description: successful operation
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ additionalProperties:
+ type: string
+ description: request body
+ required: true
+ /fake/nullable:
+ post:
+ tags:
+ - fake
+ summary: test nullable parent property
+ description: ""
+ operationId: testNullable
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ChildWithNullable'
+ description: request body
+ required: true
+ responses:
+ "200":
+ description: successful operation
+ /fake/body-with-query-params:
+ put:
+ tags:
+ - fake
+ operationId: testBodyWithQueryParams
+ parameters:
+ - name: query
+ in: query
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: Success
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ required: true
+ /another-fake/dummy:
+ patch:
+ tags:
+ - $another-fake?
+ summary: To test special tags
+ description: To test special tags and operation ID starting with number
+ operationId: '123_test_@#$%_special_tags'
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Client'
+ requestBody:
+ $ref: '#/components/requestBodies/Client'
+ /fake/body-with-file-schema:
+ put:
+ tags:
+ - fake
+ description: >-
+ For this test, the body for this request must reference a schema named
+ `File`.
+ operationId: testBodyWithFileSchema
+ responses:
+ '200':
+ description: Success
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/FileSchemaTestClass'
+ required: true
+ /fake/body-with-binary:
+ put:
+ tags:
+ - fake
+ description: >-
+ For this test, the body has to be a binary file.
+ operationId: testBodyWithBinary
+ responses:
+ '200':
+ description: Success
+ requestBody:
+ content:
+ image/png:
+ schema:
+ type: string
+ nullable: true
+ format: binary
+ description: image to upload
+ required: true
+ /fake/test-query-parameters:
+ put:
+ tags:
+ - fake
+ description: To test the collection format in query parameters
+ operationId: testQueryParameterCollectionFormat
+ parameters:
+ - name: pipe
+ in: query
+ required: true
+ style: pipeDelimited
+ schema:
+ type: array
+ items:
+ type: string
+ - name: ioutil
+ in: query
+ required: true
+ style: form
+ explode: false
+ schema:
+ type: array
+ items:
+ type: string
+ - name: http
+ in: query
+ required: true
+ style: spaceDelimited
+ schema:
+ type: array
+ items:
+ type: string
+ - name: url
+ in: query
+ required: true
+ style: form
+ explode: false
+ schema:
+ type: array
+ items:
+ type: string
+ - name: context
+ in: query
+ required: true
+ explode: true
+ schema:
+ type: array
+ items:
+ type: string
+ - name: language
+ in: query
+ required: false
+ schema:
+ type: object
+ additionalProperties:
+ type: string
+ format: string
+ - name: allowEmpty
+ in: query
+ required: true
+ allowEmptyValue: true
+ schema:
+ type: string
+ responses:
+ "200":
+ description: Success
+ '/fake/{petId}/uploadImageWithRequiredFile':
+ post:
+ tags:
+ - pet
+ summary: uploads an image (required)
+ description: ''
+ operationId: uploadFileWithRequiredFile
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet to update
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ '200':
+ description: successful operation
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ requestBody:
+ content:
+ multipart/form-data:
+ schema:
+ type: object
+ properties:
+ additionalMetadata:
+ description: Additional data to pass to server
+ type: string
+ requiredFile:
+ description: file to upload
+ type: string
+ format: binary
+ required:
+ - requiredFile
+ /fake/health:
+ get:
+ tags:
+ - fake
+ summary: Health check endpoint
+ responses:
+ 200:
+ description: The instance started successfully
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/HealthCheckResult'
+ /fake/http-signature-test:
+ get:
+ tags:
+ - fake
+ summary: test http signature authentication
+ operationId: fake-http-signature-test
+ parameters:
+ - name: query_1
+ in: query
+ description: query parameter
+ required: optional
+ schema:
+ type: string
+ - name: header_1
+ in: header
+ description: header parameter
+ required: optional
+ schema:
+ type: string
+ security:
+ - http_signature_test: []
+ requestBody:
+ $ref: '#/components/requestBodies/Pet'
+ responses:
+ 200:
+ description: The instance started successfully
+servers:
+ - url: 'http://{server}.swagger.io:{port}/v2'
+ description: petstore server
+ variables:
+ server:
+ enum:
+ - 'petstore'
+ - 'qa-petstore'
+ - 'dev-petstore'
+ default: 'petstore'
+ port:
+ enum:
+ - 80
+ - 8080
+ default: 80
+ - url: https://localhost:8080/{version}
+ description: The local server
+ variables:
+ version:
+ enum:
+ - 'v1'
+ - 'v2'
+ default: 'v2'
+ - url: https://127.0.0.1/no_varaible
+ description: The local server without variables
+components:
+ requestBodies:
+ UserArray:
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/User'
+ description: List of user object
+ required: true
+ Client:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Client'
+ description: client model
+ required: true
+ Pet:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ description: Pet object that needs to be added to the store
+ required: true
+ securitySchemes:
+ petstore_auth:
+ type: oauth2
+ flows:
+ implicit:
+ authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog'
+ scopes:
+ 'write:pets': modify pets in your account
+ 'read:pets': read your pets
+ api_key:
+ type: apiKey
+ name: api_key
+ in: header
+ api_key_query:
+ type: apiKey
+ name: api_key_query
+ in: query
+ http_basic_test:
+ type: http
+ scheme: basic
+ bearer_test:
+ type: http
+ scheme: bearer
+ bearerFormat: JWT
+ http_signature_test:
+ type: http
+ scheme: signature
+ schemas:
+ Foo:
+ type: object
+ properties:
+ bar:
+ $ref: '#/components/schemas/Bar'
+ Bar:
+ type: string
+ default: bar
+ Order:
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ petId:
+ type: integer
+ format: int64
+ quantity:
+ type: integer
+ format: int32
+ shipDate:
+ type: string
+ format: date-time
+ status:
+ type: string
+ description: Order Status
+ enum:
+ - placed
+ - approved
+ - delivered
+ complete:
+ type: boolean
+ default: false
+ xml:
+ name: Order
+ Category:
+ type: object
+ required:
+ - name
+ properties:
+ id:
+ type: integer
+ format: int64
+ name:
+ type: string
+ default: default-name
+ xml:
+ name: Category
+ User:
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ x-is-unique: true
+ username:
+ type: string
+ firstName:
+ type: string
+ lastName:
+ type: string
+ email:
+ type: string
+ password:
+ type: string
+ phone:
+ type: string
+ userStatus:
+ type: integer
+ format: int32
+ description: User Status
+ xml:
+ name: User
+ Tag:
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ name:
+ type: string
+ xml:
+ name: Tag
+ Pet:
+ type: object
+ required:
+ - name
+ - photoUrls
+ properties:
+ id:
+ type: integer
+ format: int64
+ x-is-unique: true
+ category:
+ $ref: '#/components/schemas/Category'
+ name:
+ type: string
+ example: doggie
+ photoUrls:
+ type: array
+ xml:
+ name: photoUrl
+ wrapped: true
+ items:
+ type: string
+ uniqueItems: true
+ tags:
+ type: array
+ xml:
+ name: tag
+ wrapped: true
+ items:
+ $ref: '#/components/schemas/Tag'
+ status:
+ type: string
+ description: pet status in the store
+ enum:
+ - available
+ - pending
+ - sold
+ xml:
+ name: Pet
+ ApiResponse:
+ type: object
+ properties:
+ code:
+ type: integer
+ format: int32
+ type:
+ type: string
+ message:
+ type: string
+ Return:
+ description: Model for testing reserved words
+ properties:
+ return:
+ type: integer
+ format: int32
+ xml:
+ name: Return
+ Name:
+ description: Model for testing model name same as property name
+ required:
+ - name
+ properties:
+ name:
+ type: integer
+ format: int32
+ snake_case:
+ readOnly: true
+ type: integer
+ format: int32
+ property:
+ type: string
+ 123Number:
+ type: integer
+ readOnly: true
+ xml:
+ name: Name
+ 200_response:
+ description: Model for testing model name starting with number
+ properties:
+ name:
+ type: integer
+ format: int32
+ class:
+ type: string
+ xml:
+ name: Name
+ ClassModel:
+ description: Model for testing model with "_class" property
+ properties:
+ _class:
+ type: string
+ Dog:
+ allOf:
+ - $ref: '#/components/schemas/Animal'
+ - type: object
+ properties:
+ breed:
+ type: string
+ Cat:
+ allOf:
+ - $ref: '#/components/schemas/Animal'
+ - type: object
+ properties:
+ declawed:
+ type: boolean
+ Animal:
+ type: object
+ discriminator:
+ propertyName: className
+ mapping:
+ DOG: '#/components/schemas/Dog'
+ CAT: '#/components/schemas/Cat'
+ required:
+ - className
+ properties:
+ className:
+ type: string
+ color:
+ type: string
+ default: red
+ AnimalFarm:
+ type: array
+ items:
+ $ref: '#/components/schemas/Animal'
+ format_test:
+ type: object
+ required:
+ - number
+ - byte
+ - date
+ - password
+ properties:
+ integer:
+ type: integer
+ maximum: 100
+ minimum: 10
+ int32:
+ type: integer
+ format: int32
+ maximum: 200
+ minimum: 20
+ int64:
+ type: integer
+ format: int64
+ number:
+ maximum: 543.2
+ minimum: 32.1
+ type: number
+ float:
+ type: number
+ format: float
+ maximum: 987.6
+ minimum: 54.3
+ double:
+ type: number
+ format: double
+ maximum: 123.4
+ minimum: 67.8
+ decimal:
+ type: string
+ format: number
+ string:
+ type: string
+ pattern: '/[a-z]/i'
+ byte:
+ type: string
+ format: byte
+ binary:
+ type: string
+ format: binary
+ date:
+ type: string
+ format: date
+ dateTime:
+ type: string
+ format: date-time
+ uuid:
+ type: string
+ format: uuid
+ example: 72f98069-206d-4f12-9f12-3d1e525a8e84
+ password:
+ type: string
+ format: password
+ maxLength: 64
+ minLength: 10
+ pattern_with_digits:
+ description: A string that is a 10 digit number. Can have leading zeros.
+ type: string
+ pattern: '^\d{10}$'
+ pattern_with_digits_and_delimiter:
+ description: A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.
+ type: string
+ pattern: '/^image_\d{1,3}$/i'
+ EnumClass:
+ type: string
+ default: '-efg'
+ enum:
+ - _abc
+ - '-efg'
+ - (xyz)
+ Enum_Test:
+ type: object
+ required:
+ - enum_string_required
+ properties:
+ enum_string:
+ type: string
+ enum:
+ - UPPER
+ - lower
+ - ''
+ enum_string_required:
+ type: string
+ enum:
+ - UPPER
+ - lower
+ - ''
+ enum_integer:
+ type: integer
+ format: int32
+ enum:
+ - 1
+ - -1
+ enum_number:
+ type: number
+ format: double
+ enum:
+ - 1.1
+ - -1.2
+ outerEnum:
+ $ref: '#/components/schemas/OuterEnum'
+ outerEnumInteger:
+ $ref: '#/components/schemas/OuterEnumInteger'
+ outerEnumDefaultValue:
+ $ref: '#/components/schemas/OuterEnumDefaultValue'
+ outerEnumIntegerDefaultValue:
+ $ref: '#/components/schemas/OuterEnumIntegerDefaultValue'
+ AdditionalPropertiesClass:
+ type: object
+ properties:
+ map_property:
+ type: object
+ additionalProperties:
+ type: string
+ map_of_map_property:
+ type: object
+ additionalProperties:
+ type: object
+ additionalProperties:
+ type: string
+ MixedPropertiesAndAdditionalPropertiesClass:
+ type: object
+ properties:
+ uuid:
+ type: string
+ format: uuid
+ dateTime:
+ type: string
+ format: date-time
+ map:
+ type: object
+ additionalProperties:
+ $ref: '#/components/schemas/Animal'
+ List:
+ type: object
+ properties:
+ 123-list:
+ type: string
+ Client:
+ type: object
+ properties:
+ client:
+ type: string
+ ReadOnlyFirst:
+ type: object
+ properties:
+ bar:
+ type: string
+ readOnly: true
+ baz:
+ type: string
+ hasOnlyReadOnly:
+ type: object
+ properties:
+ bar:
+ type: string
+ readOnly: true
+ foo:
+ type: string
+ readOnly: true
+ Capitalization:
+ type: object
+ properties:
+ smallCamel:
+ type: string
+ CapitalCamel:
+ type: string
+ small_Snake:
+ type: string
+ Capital_Snake:
+ type: string
+ SCA_ETH_Flow_Points:
+ type: string
+ ATT_NAME:
+ description: |
+ Name of the pet
+ type: string
+ MapTest:
+ type: object
+ properties:
+ map_map_of_string:
+ type: object
+ additionalProperties:
+ type: object
+ additionalProperties:
+ type: string
+ map_of_enum_string:
+ type: object
+ additionalProperties:
+ type: string
+ enum:
+ - UPPER
+ - lower
+ direct_map:
+ type: object
+ additionalProperties:
+ type: boolean
+ indirect_map:
+ $ref: '#/components/schemas/StringBooleanMap'
+ ArrayTest:
+ type: object
+ properties:
+ array_of_string:
+ type: array
+ items:
+ type: string
+ minItems: 0
+ maxItems: 3
+ array_array_of_integer:
+ type: array
+ items:
+ type: array
+ items:
+ type: integer
+ format: int64
+ array_array_of_model:
+ type: array
+ items:
+ type: array
+ items:
+ $ref: '#/components/schemas/ReadOnlyFirst'
+ NumberOnly:
+ type: object
+ properties:
+ JustNumber:
+ type: number
+ ArrayOfNumberOnly:
+ type: object
+ properties:
+ ArrayNumber:
+ type: array
+ items:
+ type: number
+ ArrayOfArrayOfNumberOnly:
+ type: object
+ properties:
+ ArrayArrayNumber:
+ type: array
+ items:
+ type: array
+ items:
+ type: number
+ EnumArrays:
+ type: object
+ properties:
+ just_symbol:
+ type: string
+ enum:
+ - '>='
+ - $
+ array_enum:
+ type: array
+ items:
+ type: string
+ enum:
+ - fish
+ - crab
+ OuterEnum:
+ nullable: true
+ type: string
+ enum:
+ - placed
+ - approved
+ - delivered
+ OuterEnumInteger:
+ type: integer
+ enum:
+ - 0
+ - 1
+ - 2
+ example: 2
+ OuterEnumDefaultValue:
+ type: string
+ enum:
+ - placed
+ - approved
+ - delivered
+ default: placed
+ OuterEnumIntegerDefaultValue:
+ type: integer
+ enum:
+ - 0
+ - 1
+ - 2
+ default: 0
+ OuterComposite:
+ type: object
+ properties:
+ my_number:
+ $ref: '#/components/schemas/OuterNumber'
+ my_string:
+ $ref: '#/components/schemas/OuterString'
+ my_boolean:
+ $ref: '#/components/schemas/OuterBoolean'
+ OuterNumber:
+ type: number
+ OuterString:
+ type: string
+ OuterBoolean:
+ type: boolean
+ x-codegen-body-parameter-name: boolean_post_body
+ ParentWithNullable:
+ type: object
+ discriminator:
+ propertyName: type
+ properties:
+ type:
+ type: string
+ enum:
+ - ChildWithNullable
+ nullableProperty:
+ type: string
+ nullable: true
+ ChildWithNullable:
+ allOf:
+ - $ref: '#/components/schemas/ParentWithNullable'
+ - type: object
+ properties:
+ otherProperty:
+ type: string
+ StringBooleanMap:
+ additionalProperties:
+ type: boolean
+ FileSchemaTestClass:
+ type: object
+ properties:
+ file:
+ $ref: '#/components/schemas/File'
+ files:
+ type: array
+ items:
+ $ref: '#/components/schemas/File'
+ File:
+ type: object
+ description: Must be named `File` for test.
+ properties:
+ sourceURI:
+ description: Test capitalization
+ type: string
+ _special_model.name_:
+ properties:
+ '$special[property.name]':
+ type: integer
+ format: int64
+ xml:
+ name: '$special[model.name]'
+ HealthCheckResult:
+ type: object
+ properties:
+ NullableMessage:
+ nullable: true
+ type: string
+ description: Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model.
+ NullableClass:
+ type: object
+ properties:
+ integer_prop:
+ type: integer
+ nullable: true
+ number_prop:
+ type: number
+ nullable: true
+ boolean_prop:
+ type: boolean
+ nullable: true
+ string_prop:
+ type: string
+ nullable: true
+ date_prop:
+ type: string
+ format: date
+ nullable: true
+ datetime_prop:
+ type: string
+ format: date-time
+ nullable: true
+ array_nullable_prop:
+ type: array
+ nullable: true
+ items:
+ type: object
+ array_and_items_nullable_prop:
+ type: array
+ nullable: true
+ items:
+ type: object
+ nullable: true
+ array_items_nullable:
+ type: array
+ items:
+ type: object
+ nullable: true
+ object_nullable_prop:
+ type: object
+ nullable: true
+ additionalProperties:
+ type: object
+ object_and_items_nullable_prop:
+ type: object
+ nullable: true
+ additionalProperties:
+ type: object
+ nullable: true
+ object_items_nullable:
+ type: object
+ additionalProperties:
+ type: object
+ nullable: true
+ additionalProperties:
+ type: object
+ nullable: true
+ OuterObjectWithEnumProperty:
+ type: object
+ example:
+ value: 2
+ required:
+ - value
+ properties:
+ value:
+ $ref: '#/components/schemas/OuterEnumInteger'
+ DeprecatedObject:
+ type: object
+ deprecated: true
+ properties:
+ name:
+ type: string
+ ObjectWithDeprecatedFields:
+ type: object
+ properties:
+ uuid:
+ type: string
+ id:
+ type: number
+ deprecated: true
+ deprecatedRef:
+ $ref: '#/components/schemas/DeprecatedObject'
+ bars:
+ type: array
+ deprecated: true
+ items:
+ $ref: '#/components/schemas/Bar'
+ AllOfWithSingleRef:
+ type: object
+ properties:
+ username:
+ type: string
+ SingleRefType:
+ allOf:
+ - $ref: '#/components/schemas/SingleRefType'
+ SingleRefType:
+ type: string
+ title: SingleRefType
+ enum:
+ - admin
+ - user
diff --git a/samples/client/echo_api/php-nextgen/.gitignore b/samples/client/echo_api/php-nextgen/.gitignore
new file mode 100644
index 00000000000..cc2a4bdc54f
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/.gitignore
@@ -0,0 +1,19 @@
+# ref: https://github.com/github/gitignore/blob/master/Composer.gitignore
+
+composer.phar
+/vendor/
+
+# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
+# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
+# makes sense since it's a library(client SDK) and not a project
+composer.lock
+
+# php-cs-fixer cache
+.php_cs.cache
+.php-cs-fixer.cache
+
+# PHPUnit cache
+.phpunit.result.cache
+
+# PHPLint cache
+build/phplint.cache
diff --git a/samples/client/echo_api/php-nextgen/.openapi-generator-ignore b/samples/client/echo_api/php-nextgen/.openapi-generator-ignore
new file mode 100644
index 00000000000..7484ee590a3
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/.openapi-generator-ignore
@@ -0,0 +1,23 @@
+# OpenAPI Generator Ignore
+# Generated by openapi-generator https://github.com/openapitools/openapi-generator
+
+# Use this file to prevent files from being overwritten by the generator.
+# The patterns follow closely to .gitignore or .dockerignore.
+
+# As an example, the C# client generator defines ApiClient.cs.
+# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
+#ApiClient.cs
+
+# You can match any string of characters against a directory, file or extension with a single asterisk (*):
+#foo/*/qux
+# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
+
+# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
+#foo/**/qux
+# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
+
+# You can also negate patterns with an exclamation (!).
+# For example, you can ignore all files in a docs folder with the file extension .md:
+#docs/*.md
+# Then explicitly reverse the ignore rule for a single file:
+#!docs/README.md
diff --git a/samples/client/echo_api/php-nextgen/.openapi-generator/FILES b/samples/client/echo_api/php-nextgen/.openapi-generator/FILES
new file mode 100644
index 00000000000..82705c8ca1d
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/.openapi-generator/FILES
@@ -0,0 +1,47 @@
+.gitignore
+.php-cs-fixer.dist.php
+.phplint.yml
+.travis.yml
+README.md
+composer.json
+docs/Api/AuthApi.md
+docs/Api/BodyApi.md
+docs/Api/FormApi.md
+docs/Api/HeaderApi.md
+docs/Api/PathApi.md
+docs/Api/QueryApi.md
+docs/Model/Bird.md
+docs/Model/Category.md
+docs/Model/DataQuery.md
+docs/Model/DefaultValue.md
+docs/Model/NumberPropertiesOnly.md
+docs/Model/Pet.md
+docs/Model/Query.md
+docs/Model/StringEnumRef.md
+docs/Model/Tag.md
+docs/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md
+docs/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md
+git_push.sh
+phpunit.xml.dist
+src/Api/AuthApi.php
+src/Api/BodyApi.php
+src/Api/FormApi.php
+src/Api/HeaderApi.php
+src/Api/PathApi.php
+src/Api/QueryApi.php
+src/ApiException.php
+src/Configuration.php
+src/HeaderSelector.php
+src/Model/Bird.php
+src/Model/Category.php
+src/Model/DataQuery.php
+src/Model/DefaultValue.php
+src/Model/ModelInterface.php
+src/Model/NumberPropertiesOnly.php
+src/Model/Pet.php
+src/Model/Query.php
+src/Model/StringEnumRef.php
+src/Model/Tag.php
+src/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.php
+src/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.php
+src/ObjectSerializer.php
diff --git a/samples/client/echo_api/php-nextgen/.openapi-generator/VERSION b/samples/client/echo_api/php-nextgen/.openapi-generator/VERSION
new file mode 100644
index 00000000000..44bad91b171
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/.openapi-generator/VERSION
@@ -0,0 +1 @@
+7.0.1-SNAPSHOT
\ No newline at end of file
diff --git a/samples/client/echo_api/php-nextgen/.php-cs-fixer.dist.php b/samples/client/echo_api/php-nextgen/.php-cs-fixer.dist.php
new file mode 100644
index 00000000000..af9cf39fddb
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/.php-cs-fixer.dist.php
@@ -0,0 +1,29 @@
+in(__DIR__)
+ ->exclude('vendor')
+ ->exclude('test')
+ ->exclude('tests')
+;
+
+$config = new PhpCsFixer\Config();
+return $config->setRules([
+ '@PSR12' => true,
+ 'phpdoc_order' => true,
+ 'array_syntax' => [ 'syntax' => 'short' ],
+ 'strict_comparison' => true,
+ 'strict_param' => true,
+ 'no_trailing_whitespace' => false,
+ 'no_trailing_whitespace_in_comment' => false,
+ 'braces' => false,
+ 'single_blank_line_at_eof' => false,
+ 'blank_line_after_namespace' => false,
+ 'no_leading_import_slash' => false,
+ ])
+ ->setFinder($finder)
+;
diff --git a/samples/client/echo_api/php-nextgen/.phplint.yml b/samples/client/echo_api/php-nextgen/.phplint.yml
new file mode 100644
index 00000000000..ef4be48fa2d
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/.phplint.yml
@@ -0,0 +1,11 @@
+path:
+ - ./src
+ - ./tests
+jobs: 10
+extensions:
+ - php
+exclude:
+ - vendor
+warning: true
+memory-limit: -1
+no-cache: true
diff --git a/samples/client/echo_api/php-nextgen/.travis.yml b/samples/client/echo_api/php-nextgen/.travis.yml
new file mode 100644
index 00000000000..707be2a11d5
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/.travis.yml
@@ -0,0 +1,12 @@
+language: php
+# Jammy Jellyfish environment has preinstalled PHP 8.1
+# Focal Fossa doesn't fit since it contains preinstalled PHP 7.4 only
+# https://docs.travis-ci.com/user/reference/jammy/#php-support
+dist: jammy
+os:
+ - linux
+php:
+ - 8.1
+ - 8.2
+before_install: "composer install"
+script: "vendor/bin/phpunit"
diff --git a/samples/client/echo_api/php-nextgen/README.md b/samples/client/echo_api/php-nextgen/README.md
new file mode 100644
index 00000000000..f73398ca1f4
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/README.md
@@ -0,0 +1,138 @@
+# OpenAPIClient-php
+
+Echo Server API
+
+
+## Installation & Usage
+
+### Requirements
+
+PHP 8.1 and later.
+
+### Composer
+
+To install the bindings via [Composer](https://getcomposer.org/), add the following to `composer.json`:
+
+```json
+{
+ "repositories": [
+ {
+ "type": "vcs",
+ "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
+ }
+ ],
+ "require": {
+ "GIT_USER_ID/GIT_REPO_ID": "*@dev"
+ }
+}
+```
+
+Then run `composer install`
+
+### Manual Installation
+
+Download the files and include `autoload.php`:
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+
+$apiInstance = new OpenAPI\Client\Api\AuthApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+
+try {
+ $result = $apiInstance->testAuthHttpBasic();
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling AuthApi->testAuthHttpBasic: ', $e->getMessage(), PHP_EOL;
+}
+
+```
+
+## API Endpoints
+
+All URIs are relative to *http://localhost:3000*
+
+Class | Method | HTTP request | Description
+------------ | ------------- | ------------- | -------------
+*AuthApi* | [**testAuthHttpBasic**](docs/Api/AuthApi.md#testauthhttpbasic) | **POST** /auth/http/basic | To test HTTP basic authentication
+*BodyApi* | [**testBinaryGif**](docs/Api/BodyApi.md#testbinarygif) | **POST** /binary/gif | Test binary (gif) response body
+*BodyApi* | [**testBodyApplicationOctetstreamBinary**](docs/Api/BodyApi.md#testbodyapplicationoctetstreambinary) | **POST** /body/application/octetstream/binary | Test body parameter(s)
+*BodyApi* | [**testBodyMultipartFormdataArrayOfBinary**](docs/Api/BodyApi.md#testbodymultipartformdataarrayofbinary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime
+*BodyApi* | [**testEchoBodyFreeFormObjectResponseString**](docs/Api/BodyApi.md#testechobodyfreeformobjectresponsestring) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
+*BodyApi* | [**testEchoBodyPet**](docs/Api/BodyApi.md#testechobodypet) | **POST** /echo/body/Pet | Test body parameter(s)
+*BodyApi* | [**testEchoBodyPetResponseString**](docs/Api/BodyApi.md#testechobodypetresponsestring) | **POST** /echo/body/Pet/response_string | Test empty response body
+*BodyApi* | [**testEchoBodyTagResponseString**](docs/Api/BodyApi.md#testechobodytagresponsestring) | **POST** /echo/body/Tag/response_string | Test empty json (request body)
+*FormApi* | [**testFormIntegerBooleanString**](docs/Api/FormApi.md#testformintegerbooleanstring) | **POST** /form/integer/boolean/string | Test form parameter(s)
+*FormApi* | [**testFormOneof**](docs/Api/FormApi.md#testformoneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema
+*HeaderApi* | [**testHeaderIntegerBooleanString**](docs/Api/HeaderApi.md#testheaderintegerbooleanstring) | **GET** /header/integer/boolean/string | Test header parameter(s)
+*PathApi* | [**testsPathStringPathStringIntegerPathInteger**](docs/Api/PathApi.md#testspathstringpathstringintegerpathinteger) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s)
+*QueryApi* | [**testEnumRefString**](docs/Api/QueryApi.md#testenumrefstring) | **GET** /query/enum_ref_string | Test query parameter(s)
+*QueryApi* | [**testQueryDatetimeDateString**](docs/Api/QueryApi.md#testquerydatetimedatestring) | **GET** /query/datetime/date/string | Test query parameter(s)
+*QueryApi* | [**testQueryIntegerBooleanString**](docs/Api/QueryApi.md#testqueryintegerbooleanstring) | **GET** /query/integer/boolean/string | Test query parameter(s)
+*QueryApi* | [**testQueryStyleDeepObjectExplodeTrueObject**](docs/Api/QueryApi.md#testquerystyledeepobjectexplodetrueobject) | **GET** /query/style_deepObject/explode_true/object | Test query parameter(s)
+*QueryApi* | [**testQueryStyleDeepObjectExplodeTrueObjectAllOf**](docs/Api/QueryApi.md#testquerystyledeepobjectexplodetrueobjectallof) | **GET** /query/style_deepObject/explode_true/object/allOf | Test query parameter(s)
+*QueryApi* | [**testQueryStyleFormExplodeTrueArrayString**](docs/Api/QueryApi.md#testquerystyleformexplodetruearraystring) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s)
+*QueryApi* | [**testQueryStyleFormExplodeTrueObject**](docs/Api/QueryApi.md#testquerystyleformexplodetrueobject) | **GET** /query/style_form/explode_true/object | Test query parameter(s)
+*QueryApi* | [**testQueryStyleFormExplodeTrueObjectAllOf**](docs/Api/QueryApi.md#testquerystyleformexplodetrueobjectallof) | **GET** /query/style_form/explode_true/object/allOf | Test query parameter(s)
+
+## Models
+
+- [Bird](docs/Model/Bird.md)
+- [Category](docs/Model/Category.md)
+- [DataQuery](docs/Model/DataQuery.md)
+- [DefaultValue](docs/Model/DefaultValue.md)
+- [NumberPropertiesOnly](docs/Model/NumberPropertiesOnly.md)
+- [Pet](docs/Model/Pet.md)
+- [Query](docs/Model/Query.md)
+- [StringEnumRef](docs/Model/StringEnumRef.md)
+- [Tag](docs/Model/Tag.md)
+- [TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter](docs/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md)
+- [TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md)
+
+## Authorization
+
+### http_auth
+
+- **Type**: HTTP basic authentication
+
+## Tests
+
+To run the tests, use:
+
+```bash
+composer install
+vendor/bin/phpunit
+```
+
+## Author
+
+team@openapitools.org
+
+## About this package
+
+This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
+
+- API version: `0.1.0`
+- Build package: `org.openapitools.codegen.languages.PhpNextgenClientCodegen`
diff --git a/samples/client/echo_api/php-nextgen/composer.json b/samples/client/echo_api/php-nextgen/composer.json
new file mode 100644
index 00000000000..1d2015c490e
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/composer.json
@@ -0,0 +1,45 @@
+{
+ "description": "Echo Server API",
+ "keywords": [
+ "openapitools",
+ "openapi-generator",
+ "openapi",
+ "php",
+ "sdk",
+ "rest",
+ "api"
+ ],
+ "homepage": "https://openapi-generator.tech",
+ "license": "unlicense",
+ "authors": [
+ {
+ "name": "OpenAPI-Generator contributors",
+ "homepage": "https://openapi-generator.tech"
+ }
+ ],
+ "require": {
+ "php": "^8.1",
+ "ext-curl": "*",
+ "ext-json": "*",
+ "ext-mbstring": "*",
+ "guzzlehttp/guzzle": "^7.4.5",
+ "guzzlehttp/psr7": "^2.0"
+ },
+ "require-dev": {
+ "friendsofphp/php-cs-fixer": "^3.5",
+ "overtrue/phplint": "^9.0",
+ "phpunit/phpunit": "^9.0"
+ },
+ "autoload": {
+ "psr-4": { "OpenAPI\\Client\\" : "src/" }
+ },
+ "autoload-dev": {
+ "psr-4": { "OpenAPI\\Client\\Test\\" : "tests/" }
+ },
+ "scripts": {
+ "test": [
+ "@phplint"
+ ],
+ "phplint": "phplint"
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen/docs/Api/AuthApi.md b/samples/client/echo_api/php-nextgen/docs/Api/AuthApi.md
new file mode 100644
index 00000000000..8fb88b69afe
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/docs/Api/AuthApi.md
@@ -0,0 +1,67 @@
+# OpenAPI\Client\AuthApi
+
+All URIs are relative to http://localhost:3000, except if the operation defines another base path.
+
+| Method | HTTP request | Description |
+| ------------- | ------------- | ------------- |
+| [**testAuthHttpBasic()**](AuthApi.md#testAuthHttpBasic) | **POST** /auth/http/basic | To test HTTP basic authentication |
+
+
+## `testAuthHttpBasic()`
+
+```php
+testAuthHttpBasic(): string
+```
+
+To test HTTP basic authentication
+
+To test HTTP basic authentication
+
+### Example
+
+```php
+setUsername('YOUR_USERNAME')
+ ->setPassword('YOUR_PASSWORD');
+
+
+$apiInstance = new OpenAPI\Client\Api\AuthApi(
+ // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+ // This is optional, `GuzzleHttp\Client` will be used as default.
+ new GuzzleHttp\Client(),
+ $config
+);
+
+try {
+ $result = $apiInstance->testAuthHttpBasic();
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling AuthApi->testAuthHttpBasic: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+This endpoint does not need any parameter.
+
+### Return type
+
+**string**
+
+### Authorization
+
+[http_auth](../../README.md#http_auth)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen/docs/Api/BodyApi.md b/samples/client/echo_api/php-nextgen/docs/Api/BodyApi.md
new file mode 100644
index 00000000000..84fb8a7aa78
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/docs/Api/BodyApi.md
@@ -0,0 +1,403 @@
+# OpenAPI\Client\BodyApi
+
+All URIs are relative to http://localhost:3000, except if the operation defines another base path.
+
+| Method | HTTP request | Description |
+| ------------- | ------------- | ------------- |
+| [**testBinaryGif()**](BodyApi.md#testBinaryGif) | **POST** /binary/gif | Test binary (gif) response body |
+| [**testBodyApplicationOctetstreamBinary()**](BodyApi.md#testBodyApplicationOctetstreamBinary) | **POST** /body/application/octetstream/binary | Test body parameter(s) |
+| [**testBodyMultipartFormdataArrayOfBinary()**](BodyApi.md#testBodyMultipartFormdataArrayOfBinary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime |
+| [**testEchoBodyFreeFormObjectResponseString()**](BodyApi.md#testEchoBodyFreeFormObjectResponseString) | **POST** /echo/body/FreeFormObject/response_string | Test free form object |
+| [**testEchoBodyPet()**](BodyApi.md#testEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s) |
+| [**testEchoBodyPetResponseString()**](BodyApi.md#testEchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body |
+| [**testEchoBodyTagResponseString()**](BodyApi.md#testEchoBodyTagResponseString) | **POST** /echo/body/Tag/response_string | Test empty json (request body) |
+
+
+## `testBinaryGif()`
+
+```php
+testBinaryGif(): \SplFileObject
+```
+
+Test binary (gif) response body
+
+Test binary (gif) response body
+
+### Example
+
+```php
+testBinaryGif();
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling BodyApi->testBinaryGif: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+This endpoint does not need any parameter.
+
+### Return type
+
+**\SplFileObject**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `image/gif`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testBodyApplicationOctetstreamBinary()`
+
+```php
+testBodyApplicationOctetstreamBinary($body): string
+```
+
+Test body parameter(s)
+
+Test body parameter(s)
+
+### Example
+
+```php
+testBodyApplicationOctetstreamBinary($body);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling BodyApi->testBodyApplicationOctetstreamBinary: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **body** | **\SplFileObject****\SplFileObject**| | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: `application/octet-stream`
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testBodyMultipartFormdataArrayOfBinary()`
+
+```php
+testBodyMultipartFormdataArrayOfBinary($files): string
+```
+
+Test array of binary in multipart mime
+
+Test array of binary in multipart mime
+
+### Example
+
+```php
+testBodyMultipartFormdataArrayOfBinary($files);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling BodyApi->testBodyMultipartFormdataArrayOfBinary: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **files** | **\SplFileObject[]**| | |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: `multipart/form-data`
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testEchoBodyFreeFormObjectResponseString()`
+
+```php
+testEchoBodyFreeFormObjectResponseString($body): string
+```
+
+Test free form object
+
+Test free form object
+
+### Example
+
+```php
+ new \stdClass); // object | Free form object
+
+try {
+ $result = $apiInstance->testEchoBodyFreeFormObjectResponseString($body);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling BodyApi->testEchoBodyFreeFormObjectResponseString: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **body** | **object**| Free form object | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: `application/json`
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testEchoBodyPet()`
+
+```php
+testEchoBodyPet($pet): \OpenAPI\Client\Model\Pet
+```
+
+Test body parameter(s)
+
+Test body parameter(s)
+
+### Example
+
+```php
+testEchoBodyPet($pet);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling BodyApi->testEchoBodyPet: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **pet** | [**\OpenAPI\Client\Model\Pet**](../Model/Pet.md)| Pet object that needs to be added to the store | [optional] |
+
+### Return type
+
+[**\OpenAPI\Client\Model\Pet**](../Model/Pet.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: `application/json`
+- **Accept**: `application/json`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testEchoBodyPetResponseString()`
+
+```php
+testEchoBodyPetResponseString($pet): string
+```
+
+Test empty response body
+
+Test empty response body
+
+### Example
+
+```php
+testEchoBodyPetResponseString($pet);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling BodyApi->testEchoBodyPetResponseString: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **pet** | [**\OpenAPI\Client\Model\Pet**](../Model/Pet.md)| Pet object that needs to be added to the store | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: `application/json`
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testEchoBodyTagResponseString()`
+
+```php
+testEchoBodyTagResponseString($tag): string
+```
+
+Test empty json (request body)
+
+Test empty json (request body)
+
+### Example
+
+```php
+testEchoBodyTagResponseString($tag);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling BodyApi->testEchoBodyTagResponseString: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **tag** | [**\OpenAPI\Client\Model\Tag**](../Model/Tag.md)| Tag object | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: `application/json`
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen/docs/Api/FormApi.md b/samples/client/echo_api/php-nextgen/docs/Api/FormApi.md
new file mode 100644
index 00000000000..1321378cc07
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/docs/Api/FormApi.md
@@ -0,0 +1,135 @@
+# OpenAPI\Client\FormApi
+
+All URIs are relative to http://localhost:3000, except if the operation defines another base path.
+
+| Method | HTTP request | Description |
+| ------------- | ------------- | ------------- |
+| [**testFormIntegerBooleanString()**](FormApi.md#testFormIntegerBooleanString) | **POST** /form/integer/boolean/string | Test form parameter(s) |
+| [**testFormOneof()**](FormApi.md#testFormOneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema |
+
+
+## `testFormIntegerBooleanString()`
+
+```php
+testFormIntegerBooleanString($integer_form, $boolean_form, $string_form): string
+```
+
+Test form parameter(s)
+
+Test form parameter(s)
+
+### Example
+
+```php
+testFormIntegerBooleanString($integer_form, $boolean_form, $string_form);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling FormApi->testFormIntegerBooleanString: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **integer_form** | **int**| | [optional] |
+| **boolean_form** | **bool**| | [optional] |
+| **string_form** | **string**| | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: `application/x-www-form-urlencoded`
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testFormOneof()`
+
+```php
+testFormOneof($form1, $form2, $form3, $form4, $id, $name): string
+```
+
+Test form parameter(s) for oneOf schema
+
+Test form parameter(s) for oneOf schema
+
+### Example
+
+```php
+testFormOneof($form1, $form2, $form3, $form4, $id, $name);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling FormApi->testFormOneof: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **form1** | **string**| | [optional] |
+| **form2** | **int**| | [optional] |
+| **form3** | **string**| | [optional] |
+| **form4** | **bool**| | [optional] |
+| **id** | **int**| | [optional] |
+| **name** | **string**| | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: `application/x-www-form-urlencoded`
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen/docs/Api/HeaderApi.md b/samples/client/echo_api/php-nextgen/docs/Api/HeaderApi.md
new file mode 100644
index 00000000000..12146c4b4ba
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/docs/Api/HeaderApi.md
@@ -0,0 +1,68 @@
+# OpenAPI\Client\HeaderApi
+
+All URIs are relative to http://localhost:3000, except if the operation defines another base path.
+
+| Method | HTTP request | Description |
+| ------------- | ------------- | ------------- |
+| [**testHeaderIntegerBooleanString()**](HeaderApi.md#testHeaderIntegerBooleanString) | **GET** /header/integer/boolean/string | Test header parameter(s) |
+
+
+## `testHeaderIntegerBooleanString()`
+
+```php
+testHeaderIntegerBooleanString($integer_header, $boolean_header, $string_header): string
+```
+
+Test header parameter(s)
+
+Test header parameter(s)
+
+### Example
+
+```php
+testHeaderIntegerBooleanString($integer_header, $boolean_header, $string_header);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling HeaderApi->testHeaderIntegerBooleanString: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **integer_header** | **int**| | [optional] |
+| **boolean_header** | **bool**| | [optional] |
+| **string_header** | **string**| | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen/docs/Api/PathApi.md b/samples/client/echo_api/php-nextgen/docs/Api/PathApi.md
new file mode 100644
index 00000000000..7adda508e74
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/docs/Api/PathApi.md
@@ -0,0 +1,66 @@
+# OpenAPI\Client\PathApi
+
+All URIs are relative to http://localhost:3000, except if the operation defines another base path.
+
+| Method | HTTP request | Description |
+| ------------- | ------------- | ------------- |
+| [**testsPathStringPathStringIntegerPathInteger()**](PathApi.md#testsPathStringPathStringIntegerPathInteger) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s) |
+
+
+## `testsPathStringPathStringIntegerPathInteger()`
+
+```php
+testsPathStringPathStringIntegerPathInteger($path_string, $path_integer): string
+```
+
+Test path parameter(s)
+
+Test path parameter(s)
+
+### Example
+
+```php
+testsPathStringPathStringIntegerPathInteger($path_string, $path_integer);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling PathApi->testsPathStringPathStringIntegerPathInteger: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **path_string** | **string**| | |
+| **path_integer** | **int**| | |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen/docs/Api/QueryApi.md b/samples/client/echo_api/php-nextgen/docs/Api/QueryApi.md
new file mode 100644
index 00000000000..c7534bcbdc7
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/docs/Api/QueryApi.md
@@ -0,0 +1,471 @@
+# OpenAPI\Client\QueryApi
+
+All URIs are relative to http://localhost:3000, except if the operation defines another base path.
+
+| Method | HTTP request | Description |
+| ------------- | ------------- | ------------- |
+| [**testEnumRefString()**](QueryApi.md#testEnumRefString) | **GET** /query/enum_ref_string | Test query parameter(s) |
+| [**testQueryDatetimeDateString()**](QueryApi.md#testQueryDatetimeDateString) | **GET** /query/datetime/date/string | Test query parameter(s) |
+| [**testQueryIntegerBooleanString()**](QueryApi.md#testQueryIntegerBooleanString) | **GET** /query/integer/boolean/string | Test query parameter(s) |
+| [**testQueryStyleDeepObjectExplodeTrueObject()**](QueryApi.md#testQueryStyleDeepObjectExplodeTrueObject) | **GET** /query/style_deepObject/explode_true/object | Test query parameter(s) |
+| [**testQueryStyleDeepObjectExplodeTrueObjectAllOf()**](QueryApi.md#testQueryStyleDeepObjectExplodeTrueObjectAllOf) | **GET** /query/style_deepObject/explode_true/object/allOf | Test query parameter(s) |
+| [**testQueryStyleFormExplodeTrueArrayString()**](QueryApi.md#testQueryStyleFormExplodeTrueArrayString) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s) |
+| [**testQueryStyleFormExplodeTrueObject()**](QueryApi.md#testQueryStyleFormExplodeTrueObject) | **GET** /query/style_form/explode_true/object | Test query parameter(s) |
+| [**testQueryStyleFormExplodeTrueObjectAllOf()**](QueryApi.md#testQueryStyleFormExplodeTrueObjectAllOf) | **GET** /query/style_form/explode_true/object/allOf | Test query parameter(s) |
+
+
+## `testEnumRefString()`
+
+```php
+testEnumRefString($enum_ref_string_query): string
+```
+
+Test query parameter(s)
+
+Test query parameter(s)
+
+### Example
+
+```php
+testEnumRefString($enum_ref_string_query);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling QueryApi->testEnumRefString: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **enum_ref_string_query** | [**StringEnumRef**](../Model/.md)| | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testQueryDatetimeDateString()`
+
+```php
+testQueryDatetimeDateString($datetime_query, $date_query, $string_query): string
+```
+
+Test query parameter(s)
+
+Test query parameter(s)
+
+### Example
+
+```php
+testQueryDatetimeDateString($datetime_query, $date_query, $string_query);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling QueryApi->testQueryDatetimeDateString: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **datetime_query** | **\DateTime**| | [optional] |
+| **date_query** | **\DateTime**| | [optional] |
+| **string_query** | **string**| | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testQueryIntegerBooleanString()`
+
+```php
+testQueryIntegerBooleanString($integer_query, $boolean_query, $string_query): string
+```
+
+Test query parameter(s)
+
+Test query parameter(s)
+
+### Example
+
+```php
+testQueryIntegerBooleanString($integer_query, $boolean_query, $string_query);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling QueryApi->testQueryIntegerBooleanString: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **integer_query** | **int**| | [optional] |
+| **boolean_query** | **bool**| | [optional] |
+| **string_query** | **string**| | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testQueryStyleDeepObjectExplodeTrueObject()`
+
+```php
+testQueryStyleDeepObjectExplodeTrueObject($query_object): string
+```
+
+Test query parameter(s)
+
+Test query parameter(s)
+
+### Example
+
+```php
+testQueryStyleDeepObjectExplodeTrueObject($query_object);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling QueryApi->testQueryStyleDeepObjectExplodeTrueObject: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **query_object** | [**Pet**](../Model/.md)| | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testQueryStyleDeepObjectExplodeTrueObjectAllOf()`
+
+```php
+testQueryStyleDeepObjectExplodeTrueObjectAllOf($query_object): string
+```
+
+Test query parameter(s)
+
+Test query parameter(s)
+
+### Example
+
+```php
+testQueryStyleDeepObjectExplodeTrueObjectAllOf($query_object);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling QueryApi->testQueryStyleDeepObjectExplodeTrueObjectAllOf: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **query_object** | [**TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter**](../Model/.md)| | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testQueryStyleFormExplodeTrueArrayString()`
+
+```php
+testQueryStyleFormExplodeTrueArrayString($query_object): string
+```
+
+Test query parameter(s)
+
+Test query parameter(s)
+
+### Example
+
+```php
+testQueryStyleFormExplodeTrueArrayString($query_object);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling QueryApi->testQueryStyleFormExplodeTrueArrayString: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **query_object** | [**TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter**](../Model/.md)| | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testQueryStyleFormExplodeTrueObject()`
+
+```php
+testQueryStyleFormExplodeTrueObject($query_object): string
+```
+
+Test query parameter(s)
+
+Test query parameter(s)
+
+### Example
+
+```php
+testQueryStyleFormExplodeTrueObject($query_object);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling QueryApi->testQueryStyleFormExplodeTrueObject: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **query_object** | [**Pet**](../Model/.md)| | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
+## `testQueryStyleFormExplodeTrueObjectAllOf()`
+
+```php
+testQueryStyleFormExplodeTrueObjectAllOf($query_object): string
+```
+
+Test query parameter(s)
+
+Test query parameter(s)
+
+### Example
+
+```php
+testQueryStyleFormExplodeTrueObjectAllOf($query_object);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling QueryApi->testQueryStyleFormExplodeTrueObjectAllOf: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------- | ------------- | ------------- | ------------- |
+| **query_object** | [**DataQuery**](../Model/.md)| | [optional] |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: `text/plain`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen/docs/Model/Bird.md b/samples/client/echo_api/php-nextgen/docs/Model/Bird.md
new file mode 100644
index 00000000000..e6aa9ec6b21
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/docs/Model/Bird.md
@@ -0,0 +1,10 @@
+# # Bird
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**size** | **string** | | [optional]
+**color** | **string** | | [optional]
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen/docs/Model/Category.md b/samples/client/echo_api/php-nextgen/docs/Model/Category.md
new file mode 100644
index 00000000000..7302be9d97d
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/docs/Model/Category.md
@@ -0,0 +1,10 @@
+# # Category
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **int** | | [optional]
+**name** | **string** | | [optional]
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen/docs/Model/DataQuery.md b/samples/client/echo_api/php-nextgen/docs/Model/DataQuery.md
new file mode 100644
index 00000000000..c618206597d
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/docs/Model/DataQuery.md
@@ -0,0 +1,11 @@
+# # DataQuery
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**suffix** | **string** | test suffix | [optional]
+**text** | **string** | Some text containing white spaces | [optional]
+**date** | **\DateTime** | A date | [optional]
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen/docs/Model/DefaultValue.md b/samples/client/echo_api/php-nextgen/docs/Model/DefaultValue.md
new file mode 100644
index 00000000000..a5000ed94ee
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/docs/Model/DefaultValue.md
@@ -0,0 +1,16 @@
+# # DefaultValue
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**array_string_enum_ref_default** | [**\OpenAPI\Client\Model\StringEnumRef[]**](StringEnumRef.md) | | [optional]
+**array_string_enum_default** | **string[]** | | [optional]
+**array_string_default** | **string[]** | | [optional]
+**array_integer_default** | **int[]** | | [optional]
+**array_string** | **string[]** | | [optional]
+**array_string_nullable** | **string[]** | | [optional]
+**array_string_extension_nullable** | **string[]** | | [optional]
+**string_nullable** | **string** | | [optional]
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen/docs/Model/NumberPropertiesOnly.md b/samples/client/echo_api/php-nextgen/docs/Model/NumberPropertiesOnly.md
new file mode 100644
index 00000000000..e6ea27f9be3
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/docs/Model/NumberPropertiesOnly.md
@@ -0,0 +1,11 @@
+# # NumberPropertiesOnly
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**number** | **float** | | [optional]
+**float** | **float** | | [optional]
+**double** | **float** | | [optional]
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen/docs/Model/Pet.md b/samples/client/echo_api/php-nextgen/docs/Model/Pet.md
new file mode 100644
index 00000000000..833b1a761af
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/docs/Model/Pet.md
@@ -0,0 +1,14 @@
+# # Pet
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **int** | | [optional]
+**name** | **string** | |
+**category** | [**\OpenAPI\Client\Model\Category**](Category.md) | | [optional]
+**photo_urls** | **string[]** | |
+**tags** | [**\OpenAPI\Client\Model\Tag[]**](Tag.md) | | [optional]
+**status** | **string** | pet status in the store | [optional]
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen/docs/Model/Query.md b/samples/client/echo_api/php-nextgen/docs/Model/Query.md
new file mode 100644
index 00000000000..342a9f8ffb1
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/docs/Model/Query.md
@@ -0,0 +1,10 @@
+# # Query
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **int** | Query | [optional]
+**outcomes** | **string[]** | | [optional]
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen/docs/Model/StringEnumRef.md b/samples/client/echo_api/php-nextgen/docs/Model/StringEnumRef.md
new file mode 100644
index 00000000000..71ea837b8ed
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/docs/Model/StringEnumRef.md
@@ -0,0 +1,8 @@
+# # StringEnumRef
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen/docs/Model/Tag.md b/samples/client/echo_api/php-nextgen/docs/Model/Tag.md
new file mode 100644
index 00000000000..4cf7084738b
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/docs/Model/Tag.md
@@ -0,0 +1,10 @@
+# # Tag
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **int** | | [optional]
+**name** | **string** | | [optional]
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen/docs/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md b/samples/client/echo_api/php-nextgen/docs/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md
new file mode 100644
index 00000000000..c68f7a620bc
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/docs/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md
@@ -0,0 +1,12 @@
+# # TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**size** | **string** | | [optional]
+**color** | **string** | | [optional]
+**id** | **int** | | [optional]
+**name** | **string** | | [optional]
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen/docs/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md b/samples/client/echo_api/php-nextgen/docs/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md
new file mode 100644
index 00000000000..f91817fe776
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/docs/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md
@@ -0,0 +1,9 @@
+# # TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**values** | **string[]** | | [optional]
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/echo_api/php-nextgen/git_push.sh b/samples/client/echo_api/php-nextgen/git_push.sh
new file mode 100644
index 00000000000..f53a75d4fab
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/git_push.sh
@@ -0,0 +1,57 @@
+#!/bin/sh
+# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
+#
+# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
+
+git_user_id=$1
+git_repo_id=$2
+release_note=$3
+git_host=$4
+
+if [ "$git_host" = "" ]; then
+ git_host="github.com"
+ echo "[INFO] No command line input provided. Set \$git_host to $git_host"
+fi
+
+if [ "$git_user_id" = "" ]; then
+ git_user_id="GIT_USER_ID"
+ echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
+fi
+
+if [ "$git_repo_id" = "" ]; then
+ git_repo_id="GIT_REPO_ID"
+ echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
+fi
+
+if [ "$release_note" = "" ]; then
+ release_note="Minor update"
+ echo "[INFO] No command line input provided. Set \$release_note to $release_note"
+fi
+
+# Initialize the local directory as a Git repository
+git init
+
+# Adds the files in the local repository and stages them for commit.
+git add .
+
+# Commits the tracked changes and prepares them to be pushed to a remote repository.
+git commit -m "$release_note"
+
+# Sets the new remote
+git_remote=$(git remote)
+if [ "$git_remote" = "" ]; then # git remote not defined
+
+ if [ "$GIT_TOKEN" = "" ]; then
+ echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
+ git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
+ else
+ git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
+ fi
+
+fi
+
+git pull origin master
+
+# Pushes (Forces) the changes in the local repository up to the remote repository
+echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
+git push origin master 2>&1 | grep -v 'To https'
diff --git a/samples/client/echo_api/php-nextgen/phpunit.xml.dist b/samples/client/echo_api/php-nextgen/phpunit.xml.dist
new file mode 100644
index 00000000000..1135449a8d9
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/phpunit.xml.dist
@@ -0,0 +1,18 @@
+
+
+
+
+ ./src/Api
+ ./src/Model
+
+
+
+
+ ./tests/Api
+ ./tests/Model
+
+
+
+
+
+
diff --git a/samples/client/echo_api/php-nextgen/src/Api/AuthApi.php b/samples/client/echo_api/php-nextgen/src/Api/AuthApi.php
new file mode 100644
index 00000000000..30ae128d7e1
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/src/Api/AuthApi.php
@@ -0,0 +1,411 @@
+ [
+ 'application/json',
+ ],
+ ];
+
+/**
+ * @param ClientInterface $client
+ * @param Configuration $config
+ * @param HeaderSelector $selector
+ * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
+ */
+ public function __construct(
+ ClientInterface $client = null,
+ Configuration $config = null,
+ HeaderSelector $selector = null,
+ $hostIndex = 0
+ ) {
+ $this->client = $client ?: new Client();
+ $this->config = $config ?: new Configuration();
+ $this->headerSelector = $selector ?: new HeaderSelector();
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Set the host index
+ *
+ * @param int $hostIndex Host index (required)
+ */
+ public function setHostIndex($hostIndex): void
+ {
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Get the host index
+ *
+ * @return int Host index
+ */
+ public function getHostIndex()
+ {
+ return $this->hostIndex;
+ }
+
+ /**
+ * @return Configuration
+ */
+ public function getConfig()
+ {
+ return $this->config;
+ }
+
+ /**
+ * Operation testAuthHttpBasic
+ *
+ * To test HTTP basic authentication
+ *
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAuthHttpBasic'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return string
+ */
+ public function testAuthHttpBasic(string $contentType = self::contentTypes['testAuthHttpBasic'][0])
+ {
+ list($response) = $this->testAuthHttpBasicWithHttpInfo($contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testAuthHttpBasicWithHttpInfo
+ *
+ * To test HTTP basic authentication
+ *
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAuthHttpBasic'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testAuthHttpBasicWithHttpInfo(string $contentType = self::contentTypes['testAuthHttpBasic'][0])
+ {
+ $request = $this->testAuthHttpBasicRequest($contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('string' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testAuthHttpBasicAsync
+ *
+ * To test HTTP basic authentication
+ *
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAuthHttpBasic'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testAuthHttpBasicAsync(string $contentType = self::contentTypes['testAuthHttpBasic'][0])
+ {
+ return $this->testAuthHttpBasicAsyncWithHttpInfo($contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testAuthHttpBasicAsyncWithHttpInfo
+ *
+ * To test HTTP basic authentication
+ *
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAuthHttpBasic'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testAuthHttpBasicAsyncWithHttpInfo(string $contentType = self::contentTypes['testAuthHttpBasic'][0])
+ {
+ $returnType = 'string';
+ $request = $this->testAuthHttpBasicRequest($contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testAuthHttpBasic'
+ *
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testAuthHttpBasic'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testAuthHttpBasicRequest(string $contentType = self::contentTypes['testAuthHttpBasic'][0])
+ {
+
+
+ $resourcePath = '/auth/http/basic';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires HTTP basic authentication
+ if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
+ $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Create http client option
+ *
+ * @throws \RuntimeException on file opening failure
+ * @return array of http client options
+ */
+ protected function createHttpClientOption()
+ {
+ $options = [];
+ if ($this->config->getDebug()) {
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
+ if (!$options[RequestOptions::DEBUG]) {
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
+ }
+ }
+
+ return $options;
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen/src/Api/BodyApi.php b/samples/client/echo_api/php-nextgen/src/Api/BodyApi.php
new file mode 100644
index 00000000000..8456fd77969
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/src/Api/BodyApi.php
@@ -0,0 +1,2092 @@
+ [
+ 'application/json',
+ ],
+ 'testBodyApplicationOctetstreamBinary' => [
+ 'application/octet-stream',
+ ],
+ 'testBodyMultipartFormdataArrayOfBinary' => [
+ 'multipart/form-data',
+ ],
+ 'testEchoBodyFreeFormObjectResponseString' => [
+ 'application/json',
+ ],
+ 'testEchoBodyPet' => [
+ 'application/json',
+ ],
+ 'testEchoBodyPetResponseString' => [
+ 'application/json',
+ ],
+ 'testEchoBodyTagResponseString' => [
+ 'application/json',
+ ],
+ ];
+
+/**
+ * @param ClientInterface $client
+ * @param Configuration $config
+ * @param HeaderSelector $selector
+ * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
+ */
+ public function __construct(
+ ClientInterface $client = null,
+ Configuration $config = null,
+ HeaderSelector $selector = null,
+ $hostIndex = 0
+ ) {
+ $this->client = $client ?: new Client();
+ $this->config = $config ?: new Configuration();
+ $this->headerSelector = $selector ?: new HeaderSelector();
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Set the host index
+ *
+ * @param int $hostIndex Host index (required)
+ */
+ public function setHostIndex($hostIndex): void
+ {
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Get the host index
+ *
+ * @return int Host index
+ */
+ public function getHostIndex()
+ {
+ return $this->hostIndex;
+ }
+
+ /**
+ * @return Configuration
+ */
+ public function getConfig()
+ {
+ return $this->config;
+ }
+
+ /**
+ * Operation testBinaryGif
+ *
+ * Test binary (gif) response body
+ *
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBinaryGif'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return \SplFileObject
+ */
+ public function testBinaryGif(string $contentType = self::contentTypes['testBinaryGif'][0])
+ {
+ list($response) = $this->testBinaryGifWithHttpInfo($contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testBinaryGifWithHttpInfo
+ *
+ * Test binary (gif) response body
+ *
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBinaryGif'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of \SplFileObject, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testBinaryGifWithHttpInfo(string $contentType = self::contentTypes['testBinaryGif'][0])
+ {
+ $request = $this->testBinaryGifRequest($contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('\SplFileObject' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SplFileObject' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SplFileObject', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = '\SplFileObject';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SplFileObject',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testBinaryGifAsync
+ *
+ * Test binary (gif) response body
+ *
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBinaryGif'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testBinaryGifAsync(string $contentType = self::contentTypes['testBinaryGif'][0])
+ {
+ return $this->testBinaryGifAsyncWithHttpInfo($contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testBinaryGifAsyncWithHttpInfo
+ *
+ * Test binary (gif) response body
+ *
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBinaryGif'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testBinaryGifAsyncWithHttpInfo(string $contentType = self::contentTypes['testBinaryGif'][0])
+ {
+ $returnType = '\SplFileObject';
+ $request = $this->testBinaryGifRequest($contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testBinaryGif'
+ *
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBinaryGif'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testBinaryGifRequest(string $contentType = self::contentTypes['testBinaryGif'][0])
+ {
+
+
+ $resourcePath = '/binary/gif';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['image/gif', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testBodyApplicationOctetstreamBinary
+ *
+ * Test body parameter(s)
+ *
+ * @param \SplFileObject $body body (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyApplicationOctetstreamBinary'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return string
+ */
+ public function testBodyApplicationOctetstreamBinary($body = null, string $contentType = self::contentTypes['testBodyApplicationOctetstreamBinary'][0])
+ {
+ list($response) = $this->testBodyApplicationOctetstreamBinaryWithHttpInfo($body, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testBodyApplicationOctetstreamBinaryWithHttpInfo
+ *
+ * Test body parameter(s)
+ *
+ * @param \SplFileObject $body (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyApplicationOctetstreamBinary'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testBodyApplicationOctetstreamBinaryWithHttpInfo($body = null, string $contentType = self::contentTypes['testBodyApplicationOctetstreamBinary'][0])
+ {
+ $request = $this->testBodyApplicationOctetstreamBinaryRequest($body, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('string' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testBodyApplicationOctetstreamBinaryAsync
+ *
+ * Test body parameter(s)
+ *
+ * @param \SplFileObject $body (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyApplicationOctetstreamBinary'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testBodyApplicationOctetstreamBinaryAsync($body = null, string $contentType = self::contentTypes['testBodyApplicationOctetstreamBinary'][0])
+ {
+ return $this->testBodyApplicationOctetstreamBinaryAsyncWithHttpInfo($body, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testBodyApplicationOctetstreamBinaryAsyncWithHttpInfo
+ *
+ * Test body parameter(s)
+ *
+ * @param \SplFileObject $body (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyApplicationOctetstreamBinary'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testBodyApplicationOctetstreamBinaryAsyncWithHttpInfo($body = null, string $contentType = self::contentTypes['testBodyApplicationOctetstreamBinary'][0])
+ {
+ $returnType = 'string';
+ $request = $this->testBodyApplicationOctetstreamBinaryRequest($body, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testBodyApplicationOctetstreamBinary'
+ *
+ * @param \SplFileObject $body (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyApplicationOctetstreamBinary'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testBodyApplicationOctetstreamBinaryRequest($body = null, string $contentType = self::contentTypes['testBodyApplicationOctetstreamBinary'][0])
+ {
+
+
+
+ $resourcePath = '/body/application/octetstream/binary';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($body)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body));
+ } else {
+ $httpBody = $body;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testBodyMultipartFormdataArrayOfBinary
+ *
+ * Test array of binary in multipart mime
+ *
+ * @param \SplFileObject[] $files files (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyMultipartFormdataArrayOfBinary'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return string
+ */
+ public function testBodyMultipartFormdataArrayOfBinary($files, string $contentType = self::contentTypes['testBodyMultipartFormdataArrayOfBinary'][0])
+ {
+ list($response) = $this->testBodyMultipartFormdataArrayOfBinaryWithHttpInfo($files, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testBodyMultipartFormdataArrayOfBinaryWithHttpInfo
+ *
+ * Test array of binary in multipart mime
+ *
+ * @param \SplFileObject[] $files (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyMultipartFormdataArrayOfBinary'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testBodyMultipartFormdataArrayOfBinaryWithHttpInfo($files, string $contentType = self::contentTypes['testBodyMultipartFormdataArrayOfBinary'][0])
+ {
+ $request = $this->testBodyMultipartFormdataArrayOfBinaryRequest($files, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('string' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testBodyMultipartFormdataArrayOfBinaryAsync
+ *
+ * Test array of binary in multipart mime
+ *
+ * @param \SplFileObject[] $files (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyMultipartFormdataArrayOfBinary'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testBodyMultipartFormdataArrayOfBinaryAsync($files, string $contentType = self::contentTypes['testBodyMultipartFormdataArrayOfBinary'][0])
+ {
+ return $this->testBodyMultipartFormdataArrayOfBinaryAsyncWithHttpInfo($files, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testBodyMultipartFormdataArrayOfBinaryAsyncWithHttpInfo
+ *
+ * Test array of binary in multipart mime
+ *
+ * @param \SplFileObject[] $files (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyMultipartFormdataArrayOfBinary'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testBodyMultipartFormdataArrayOfBinaryAsyncWithHttpInfo($files, string $contentType = self::contentTypes['testBodyMultipartFormdataArrayOfBinary'][0])
+ {
+ $returnType = 'string';
+ $request = $this->testBodyMultipartFormdataArrayOfBinaryRequest($files, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testBodyMultipartFormdataArrayOfBinary'
+ *
+ * @param \SplFileObject[] $files (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testBodyMultipartFormdataArrayOfBinary'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testBodyMultipartFormdataArrayOfBinaryRequest($files, string $contentType = self::contentTypes['testBodyMultipartFormdataArrayOfBinary'][0])
+ {
+
+ // verify the required parameter 'files' is set
+ if ($files === null || (is_array($files) && count($files) === 0)) {
+ throw new \InvalidArgumentException(
+ 'Missing the required parameter $files when calling testBodyMultipartFormdataArrayOfBinary'
+ );
+ }
+
+
+ $resourcePath = '/body/application/octetstream/array_of_binary';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+
+ // form params
+ if ($files !== null) {
+ $multipart = true;
+ $formParams['files'] = [];
+ $paramFiles = is_array($files) ? $files : [$files];
+ foreach ($paramFiles as $paramFile) {
+ $formParams['files'][] = \GuzzleHttp\Psr7\Utils::tryFopen(
+ ObjectSerializer::toFormValue($paramFile),
+ 'rb'
+ );
+ }
+ }
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testEchoBodyFreeFormObjectResponseString
+ *
+ * Test free form object
+ *
+ * @param object $body Free form object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyFreeFormObjectResponseString'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return string
+ */
+ public function testEchoBodyFreeFormObjectResponseString($body = null, string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0])
+ {
+ list($response) = $this->testEchoBodyFreeFormObjectResponseStringWithHttpInfo($body, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testEchoBodyFreeFormObjectResponseStringWithHttpInfo
+ *
+ * Test free form object
+ *
+ * @param object $body Free form object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyFreeFormObjectResponseString'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testEchoBodyFreeFormObjectResponseStringWithHttpInfo($body = null, string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0])
+ {
+ $request = $this->testEchoBodyFreeFormObjectResponseStringRequest($body, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('string' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testEchoBodyFreeFormObjectResponseStringAsync
+ *
+ * Test free form object
+ *
+ * @param object $body Free form object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyFreeFormObjectResponseString'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testEchoBodyFreeFormObjectResponseStringAsync($body = null, string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0])
+ {
+ return $this->testEchoBodyFreeFormObjectResponseStringAsyncWithHttpInfo($body, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testEchoBodyFreeFormObjectResponseStringAsyncWithHttpInfo
+ *
+ * Test free form object
+ *
+ * @param object $body Free form object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyFreeFormObjectResponseString'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testEchoBodyFreeFormObjectResponseStringAsyncWithHttpInfo($body = null, string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0])
+ {
+ $returnType = 'string';
+ $request = $this->testEchoBodyFreeFormObjectResponseStringRequest($body, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testEchoBodyFreeFormObjectResponseString'
+ *
+ * @param object $body Free form object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyFreeFormObjectResponseString'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testEchoBodyFreeFormObjectResponseStringRequest($body = null, string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0])
+ {
+
+
+
+ $resourcePath = '/echo/body/FreeFormObject/response_string';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($body)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body));
+ } else {
+ $httpBody = $body;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testEchoBodyPet
+ *
+ * Test body parameter(s)
+ *
+ * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyPet'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return \OpenAPI\Client\Model\Pet
+ */
+ public function testEchoBodyPet($pet = null, string $contentType = self::contentTypes['testEchoBodyPet'][0])
+ {
+ list($response) = $this->testEchoBodyPetWithHttpInfo($pet, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testEchoBodyPetWithHttpInfo
+ *
+ * Test body parameter(s)
+ *
+ * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyPet'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of \OpenAPI\Client\Model\Pet, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testEchoBodyPetWithHttpInfo($pet = null, string $contentType = self::contentTypes['testEchoBodyPet'][0])
+ {
+ $request = $this->testEchoBodyPetRequest($pet, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('\OpenAPI\Client\Model\Pet' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\OpenAPI\Client\Model\Pet' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Pet', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = '\OpenAPI\Client\Model\Pet';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\OpenAPI\Client\Model\Pet',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testEchoBodyPetAsync
+ *
+ * Test body parameter(s)
+ *
+ * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyPet'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testEchoBodyPetAsync($pet = null, string $contentType = self::contentTypes['testEchoBodyPet'][0])
+ {
+ return $this->testEchoBodyPetAsyncWithHttpInfo($pet, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testEchoBodyPetAsyncWithHttpInfo
+ *
+ * Test body parameter(s)
+ *
+ * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyPet'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testEchoBodyPetAsyncWithHttpInfo($pet = null, string $contentType = self::contentTypes['testEchoBodyPet'][0])
+ {
+ $returnType = '\OpenAPI\Client\Model\Pet';
+ $request = $this->testEchoBodyPetRequest($pet, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testEchoBodyPet'
+ *
+ * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyPet'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testEchoBodyPetRequest($pet = null, string $contentType = self::contentTypes['testEchoBodyPet'][0])
+ {
+
+
+
+ $resourcePath = '/echo/body/Pet';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($pet)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($pet));
+ } else {
+ $httpBody = $pet;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testEchoBodyPetResponseString
+ *
+ * Test empty response body
+ *
+ * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyPetResponseString'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return string
+ */
+ public function testEchoBodyPetResponseString($pet = null, string $contentType = self::contentTypes['testEchoBodyPetResponseString'][0])
+ {
+ list($response) = $this->testEchoBodyPetResponseStringWithHttpInfo($pet, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testEchoBodyPetResponseStringWithHttpInfo
+ *
+ * Test empty response body
+ *
+ * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyPetResponseString'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testEchoBodyPetResponseStringWithHttpInfo($pet = null, string $contentType = self::contentTypes['testEchoBodyPetResponseString'][0])
+ {
+ $request = $this->testEchoBodyPetResponseStringRequest($pet, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('string' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testEchoBodyPetResponseStringAsync
+ *
+ * Test empty response body
+ *
+ * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyPetResponseString'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testEchoBodyPetResponseStringAsync($pet = null, string $contentType = self::contentTypes['testEchoBodyPetResponseString'][0])
+ {
+ return $this->testEchoBodyPetResponseStringAsyncWithHttpInfo($pet, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testEchoBodyPetResponseStringAsyncWithHttpInfo
+ *
+ * Test empty response body
+ *
+ * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyPetResponseString'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testEchoBodyPetResponseStringAsyncWithHttpInfo($pet = null, string $contentType = self::contentTypes['testEchoBodyPetResponseString'][0])
+ {
+ $returnType = 'string';
+ $request = $this->testEchoBodyPetResponseStringRequest($pet, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testEchoBodyPetResponseString'
+ *
+ * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyPetResponseString'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testEchoBodyPetResponseStringRequest($pet = null, string $contentType = self::contentTypes['testEchoBodyPetResponseString'][0])
+ {
+
+
+
+ $resourcePath = '/echo/body/Pet/response_string';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($pet)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($pet));
+ } else {
+ $httpBody = $pet;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testEchoBodyTagResponseString
+ *
+ * Test empty json (request body)
+ *
+ * @param \OpenAPI\Client\Model\Tag $tag Tag object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyTagResponseString'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return string
+ */
+ public function testEchoBodyTagResponseString($tag = null, string $contentType = self::contentTypes['testEchoBodyTagResponseString'][0])
+ {
+ list($response) = $this->testEchoBodyTagResponseStringWithHttpInfo($tag, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testEchoBodyTagResponseStringWithHttpInfo
+ *
+ * Test empty json (request body)
+ *
+ * @param \OpenAPI\Client\Model\Tag $tag Tag object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyTagResponseString'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testEchoBodyTagResponseStringWithHttpInfo($tag = null, string $contentType = self::contentTypes['testEchoBodyTagResponseString'][0])
+ {
+ $request = $this->testEchoBodyTagResponseStringRequest($tag, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('string' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testEchoBodyTagResponseStringAsync
+ *
+ * Test empty json (request body)
+ *
+ * @param \OpenAPI\Client\Model\Tag $tag Tag object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyTagResponseString'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testEchoBodyTagResponseStringAsync($tag = null, string $contentType = self::contentTypes['testEchoBodyTagResponseString'][0])
+ {
+ return $this->testEchoBodyTagResponseStringAsyncWithHttpInfo($tag, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testEchoBodyTagResponseStringAsyncWithHttpInfo
+ *
+ * Test empty json (request body)
+ *
+ * @param \OpenAPI\Client\Model\Tag $tag Tag object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyTagResponseString'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testEchoBodyTagResponseStringAsyncWithHttpInfo($tag = null, string $contentType = self::contentTypes['testEchoBodyTagResponseString'][0])
+ {
+ $returnType = 'string';
+ $request = $this->testEchoBodyTagResponseStringRequest($tag, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testEchoBodyTagResponseString'
+ *
+ * @param \OpenAPI\Client\Model\Tag $tag Tag object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEchoBodyTagResponseString'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testEchoBodyTagResponseStringRequest($tag = null, string $contentType = self::contentTypes['testEchoBodyTagResponseString'][0])
+ {
+
+
+
+ $resourcePath = '/echo/body/Tag/response_string';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($tag)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($tag));
+ } else {
+ $httpBody = $tag;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Create http client option
+ *
+ * @throws \RuntimeException on file opening failure
+ * @return array of http client options
+ */
+ protected function createHttpClientOption()
+ {
+ $options = [];
+ if ($this->config->getDebug()) {
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
+ if (!$options[RequestOptions::DEBUG]) {
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
+ }
+ }
+
+ return $options;
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen/src/Api/FormApi.php b/samples/client/echo_api/php-nextgen/src/Api/FormApi.php
new file mode 100644
index 00000000000..5c2a2d00027
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/src/Api/FormApi.php
@@ -0,0 +1,763 @@
+ [
+ 'application/x-www-form-urlencoded',
+ ],
+ 'testFormOneof' => [
+ 'application/x-www-form-urlencoded',
+ ],
+ ];
+
+/**
+ * @param ClientInterface $client
+ * @param Configuration $config
+ * @param HeaderSelector $selector
+ * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
+ */
+ public function __construct(
+ ClientInterface $client = null,
+ Configuration $config = null,
+ HeaderSelector $selector = null,
+ $hostIndex = 0
+ ) {
+ $this->client = $client ?: new Client();
+ $this->config = $config ?: new Configuration();
+ $this->headerSelector = $selector ?: new HeaderSelector();
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Set the host index
+ *
+ * @param int $hostIndex Host index (required)
+ */
+ public function setHostIndex($hostIndex): void
+ {
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Get the host index
+ *
+ * @return int Host index
+ */
+ public function getHostIndex()
+ {
+ return $this->hostIndex;
+ }
+
+ /**
+ * @return Configuration
+ */
+ public function getConfig()
+ {
+ return $this->config;
+ }
+
+ /**
+ * Operation testFormIntegerBooleanString
+ *
+ * Test form parameter(s)
+ *
+ * @param int $integer_form integer_form (optional)
+ * @param bool $boolean_form boolean_form (optional)
+ * @param string $string_form string_form (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormIntegerBooleanString'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return string
+ */
+ public function testFormIntegerBooleanString($integer_form = null, $boolean_form = null, $string_form = null, string $contentType = self::contentTypes['testFormIntegerBooleanString'][0])
+ {
+ list($response) = $this->testFormIntegerBooleanStringWithHttpInfo($integer_form, $boolean_form, $string_form, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testFormIntegerBooleanStringWithHttpInfo
+ *
+ * Test form parameter(s)
+ *
+ * @param int $integer_form (optional)
+ * @param bool $boolean_form (optional)
+ * @param string $string_form (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormIntegerBooleanString'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testFormIntegerBooleanStringWithHttpInfo($integer_form = null, $boolean_form = null, $string_form = null, string $contentType = self::contentTypes['testFormIntegerBooleanString'][0])
+ {
+ $request = $this->testFormIntegerBooleanStringRequest($integer_form, $boolean_form, $string_form, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('string' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testFormIntegerBooleanStringAsync
+ *
+ * Test form parameter(s)
+ *
+ * @param int $integer_form (optional)
+ * @param bool $boolean_form (optional)
+ * @param string $string_form (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormIntegerBooleanString'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testFormIntegerBooleanStringAsync($integer_form = null, $boolean_form = null, $string_form = null, string $contentType = self::contentTypes['testFormIntegerBooleanString'][0])
+ {
+ return $this->testFormIntegerBooleanStringAsyncWithHttpInfo($integer_form, $boolean_form, $string_form, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testFormIntegerBooleanStringAsyncWithHttpInfo
+ *
+ * Test form parameter(s)
+ *
+ * @param int $integer_form (optional)
+ * @param bool $boolean_form (optional)
+ * @param string $string_form (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormIntegerBooleanString'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testFormIntegerBooleanStringAsyncWithHttpInfo($integer_form = null, $boolean_form = null, $string_form = null, string $contentType = self::contentTypes['testFormIntegerBooleanString'][0])
+ {
+ $returnType = 'string';
+ $request = $this->testFormIntegerBooleanStringRequest($integer_form, $boolean_form, $string_form, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testFormIntegerBooleanString'
+ *
+ * @param int $integer_form (optional)
+ * @param bool $boolean_form (optional)
+ * @param string $string_form (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormIntegerBooleanString'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testFormIntegerBooleanStringRequest($integer_form = null, $boolean_form = null, $string_form = null, string $contentType = self::contentTypes['testFormIntegerBooleanString'][0])
+ {
+
+
+
+
+
+ $resourcePath = '/form/integer/boolean/string';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+
+ // form params
+ if ($integer_form !== null) {
+ $formParams['integer_form'] = ObjectSerializer::toFormValue($integer_form);
+ }
+ // form params
+ if ($boolean_form !== null) {
+ $formParams['boolean_form'] = ObjectSerializer::toFormValue($boolean_form);
+ }
+ // form params
+ if ($string_form !== null) {
+ $formParams['string_form'] = ObjectSerializer::toFormValue($string_form);
+ }
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testFormOneof
+ *
+ * Test form parameter(s) for oneOf schema
+ *
+ * @param string $form1 form1 (optional)
+ * @param int $form2 form2 (optional)
+ * @param string $form3 form3 (optional)
+ * @param bool $form4 form4 (optional)
+ * @param int $id id (optional)
+ * @param string $name name (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormOneof'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return string
+ */
+ public function testFormOneof($form1 = null, $form2 = null, $form3 = null, $form4 = null, $id = null, $name = null, string $contentType = self::contentTypes['testFormOneof'][0])
+ {
+ list($response) = $this->testFormOneofWithHttpInfo($form1, $form2, $form3, $form4, $id, $name, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testFormOneofWithHttpInfo
+ *
+ * Test form parameter(s) for oneOf schema
+ *
+ * @param string $form1 (optional)
+ * @param int $form2 (optional)
+ * @param string $form3 (optional)
+ * @param bool $form4 (optional)
+ * @param int $id (optional)
+ * @param string $name (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormOneof'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testFormOneofWithHttpInfo($form1 = null, $form2 = null, $form3 = null, $form4 = null, $id = null, $name = null, string $contentType = self::contentTypes['testFormOneof'][0])
+ {
+ $request = $this->testFormOneofRequest($form1, $form2, $form3, $form4, $id, $name, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('string' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testFormOneofAsync
+ *
+ * Test form parameter(s) for oneOf schema
+ *
+ * @param string $form1 (optional)
+ * @param int $form2 (optional)
+ * @param string $form3 (optional)
+ * @param bool $form4 (optional)
+ * @param int $id (optional)
+ * @param string $name (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormOneof'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testFormOneofAsync($form1 = null, $form2 = null, $form3 = null, $form4 = null, $id = null, $name = null, string $contentType = self::contentTypes['testFormOneof'][0])
+ {
+ return $this->testFormOneofAsyncWithHttpInfo($form1, $form2, $form3, $form4, $id, $name, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testFormOneofAsyncWithHttpInfo
+ *
+ * Test form parameter(s) for oneOf schema
+ *
+ * @param string $form1 (optional)
+ * @param int $form2 (optional)
+ * @param string $form3 (optional)
+ * @param bool $form4 (optional)
+ * @param int $id (optional)
+ * @param string $name (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormOneof'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testFormOneofAsyncWithHttpInfo($form1 = null, $form2 = null, $form3 = null, $form4 = null, $id = null, $name = null, string $contentType = self::contentTypes['testFormOneof'][0])
+ {
+ $returnType = 'string';
+ $request = $this->testFormOneofRequest($form1, $form2, $form3, $form4, $id, $name, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testFormOneof'
+ *
+ * @param string $form1 (optional)
+ * @param int $form2 (optional)
+ * @param string $form3 (optional)
+ * @param bool $form4 (optional)
+ * @param int $id (optional)
+ * @param string $name (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testFormOneof'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testFormOneofRequest($form1 = null, $form2 = null, $form3 = null, $form4 = null, $id = null, $name = null, string $contentType = self::contentTypes['testFormOneof'][0])
+ {
+
+
+
+
+
+
+
+
+ $resourcePath = '/form/oneof';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+
+ // form params
+ if ($form1 !== null) {
+ $formParams['form1'] = ObjectSerializer::toFormValue($form1);
+ }
+ // form params
+ if ($form2 !== null) {
+ $formParams['form2'] = ObjectSerializer::toFormValue($form2);
+ }
+ // form params
+ if ($form3 !== null) {
+ $formParams['form3'] = ObjectSerializer::toFormValue($form3);
+ }
+ // form params
+ if ($form4 !== null) {
+ $formParams['form4'] = ObjectSerializer::toFormValue($form4);
+ }
+ // form params
+ if ($id !== null) {
+ $formParams['id'] = ObjectSerializer::toFormValue($id);
+ }
+ // form params
+ if ($name !== null) {
+ $formParams['name'] = ObjectSerializer::toFormValue($name);
+ }
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'POST',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Create http client option
+ *
+ * @throws \RuntimeException on file opening failure
+ * @return array of http client options
+ */
+ protected function createHttpClientOption()
+ {
+ $options = [];
+ if ($this->config->getDebug()) {
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
+ if (!$options[RequestOptions::DEBUG]) {
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
+ }
+ }
+
+ return $options;
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen/src/Api/HeaderApi.php b/samples/client/echo_api/php-nextgen/src/Api/HeaderApi.php
new file mode 100644
index 00000000000..3f6f1a0da6b
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/src/Api/HeaderApi.php
@@ -0,0 +1,437 @@
+ [
+ 'application/json',
+ ],
+ ];
+
+/**
+ * @param ClientInterface $client
+ * @param Configuration $config
+ * @param HeaderSelector $selector
+ * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
+ */
+ public function __construct(
+ ClientInterface $client = null,
+ Configuration $config = null,
+ HeaderSelector $selector = null,
+ $hostIndex = 0
+ ) {
+ $this->client = $client ?: new Client();
+ $this->config = $config ?: new Configuration();
+ $this->headerSelector = $selector ?: new HeaderSelector();
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Set the host index
+ *
+ * @param int $hostIndex Host index (required)
+ */
+ public function setHostIndex($hostIndex): void
+ {
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Get the host index
+ *
+ * @return int Host index
+ */
+ public function getHostIndex()
+ {
+ return $this->hostIndex;
+ }
+
+ /**
+ * @return Configuration
+ */
+ public function getConfig()
+ {
+ return $this->config;
+ }
+
+ /**
+ * Operation testHeaderIntegerBooleanString
+ *
+ * Test header parameter(s)
+ *
+ * @param int $integer_header integer_header (optional)
+ * @param bool $boolean_header boolean_header (optional)
+ * @param string $string_header string_header (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testHeaderIntegerBooleanString'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return string
+ */
+ public function testHeaderIntegerBooleanString($integer_header = null, $boolean_header = null, $string_header = null, string $contentType = self::contentTypes['testHeaderIntegerBooleanString'][0])
+ {
+ list($response) = $this->testHeaderIntegerBooleanStringWithHttpInfo($integer_header, $boolean_header, $string_header, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testHeaderIntegerBooleanStringWithHttpInfo
+ *
+ * Test header parameter(s)
+ *
+ * @param int $integer_header (optional)
+ * @param bool $boolean_header (optional)
+ * @param string $string_header (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testHeaderIntegerBooleanString'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testHeaderIntegerBooleanStringWithHttpInfo($integer_header = null, $boolean_header = null, $string_header = null, string $contentType = self::contentTypes['testHeaderIntegerBooleanString'][0])
+ {
+ $request = $this->testHeaderIntegerBooleanStringRequest($integer_header, $boolean_header, $string_header, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('string' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testHeaderIntegerBooleanStringAsync
+ *
+ * Test header parameter(s)
+ *
+ * @param int $integer_header (optional)
+ * @param bool $boolean_header (optional)
+ * @param string $string_header (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testHeaderIntegerBooleanString'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testHeaderIntegerBooleanStringAsync($integer_header = null, $boolean_header = null, $string_header = null, string $contentType = self::contentTypes['testHeaderIntegerBooleanString'][0])
+ {
+ return $this->testHeaderIntegerBooleanStringAsyncWithHttpInfo($integer_header, $boolean_header, $string_header, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testHeaderIntegerBooleanStringAsyncWithHttpInfo
+ *
+ * Test header parameter(s)
+ *
+ * @param int $integer_header (optional)
+ * @param bool $boolean_header (optional)
+ * @param string $string_header (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testHeaderIntegerBooleanString'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testHeaderIntegerBooleanStringAsyncWithHttpInfo($integer_header = null, $boolean_header = null, $string_header = null, string $contentType = self::contentTypes['testHeaderIntegerBooleanString'][0])
+ {
+ $returnType = 'string';
+ $request = $this->testHeaderIntegerBooleanStringRequest($integer_header, $boolean_header, $string_header, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testHeaderIntegerBooleanString'
+ *
+ * @param int $integer_header (optional)
+ * @param bool $boolean_header (optional)
+ * @param string $string_header (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testHeaderIntegerBooleanString'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testHeaderIntegerBooleanStringRequest($integer_header = null, $boolean_header = null, $string_header = null, string $contentType = self::contentTypes['testHeaderIntegerBooleanString'][0])
+ {
+
+
+
+
+
+ $resourcePath = '/header/integer/boolean/string';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+ // header params
+ if ($integer_header !== null) {
+ $headerParams['integer_header'] = ObjectSerializer::toHeaderValue($integer_header);
+ }
+ // header params
+ if ($boolean_header !== null) {
+ $headerParams['boolean_header'] = ObjectSerializer::toHeaderValue($boolean_header);
+ }
+ // header params
+ if ($string_header !== null) {
+ $headerParams['string_header'] = ObjectSerializer::toHeaderValue($string_header);
+ }
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Create http client option
+ *
+ * @throws \RuntimeException on file opening failure
+ * @return array of http client options
+ */
+ protected function createHttpClientOption()
+ {
+ $options = [];
+ if ($this->config->getDebug()) {
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
+ if (!$options[RequestOptions::DEBUG]) {
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
+ }
+ }
+
+ return $options;
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen/src/Api/PathApi.php b/samples/client/echo_api/php-nextgen/src/Api/PathApi.php
new file mode 100644
index 00000000000..c745e61ca33
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/src/Api/PathApi.php
@@ -0,0 +1,447 @@
+ [
+ 'application/json',
+ ],
+ ];
+
+/**
+ * @param ClientInterface $client
+ * @param Configuration $config
+ * @param HeaderSelector $selector
+ * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
+ */
+ public function __construct(
+ ClientInterface $client = null,
+ Configuration $config = null,
+ HeaderSelector $selector = null,
+ $hostIndex = 0
+ ) {
+ $this->client = $client ?: new Client();
+ $this->config = $config ?: new Configuration();
+ $this->headerSelector = $selector ?: new HeaderSelector();
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Set the host index
+ *
+ * @param int $hostIndex Host index (required)
+ */
+ public function setHostIndex($hostIndex): void
+ {
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Get the host index
+ *
+ * @return int Host index
+ */
+ public function getHostIndex()
+ {
+ return $this->hostIndex;
+ }
+
+ /**
+ * @return Configuration
+ */
+ public function getConfig()
+ {
+ return $this->config;
+ }
+
+ /**
+ * Operation testsPathStringPathStringIntegerPathInteger
+ *
+ * Test path parameter(s)
+ *
+ * @param string $path_string path_string (required)
+ * @param int $path_integer path_integer (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testsPathStringPathStringIntegerPathInteger'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return string
+ */
+ public function testsPathStringPathStringIntegerPathInteger($path_string, $path_integer, string $contentType = self::contentTypes['testsPathStringPathStringIntegerPathInteger'][0])
+ {
+ list($response) = $this->testsPathStringPathStringIntegerPathIntegerWithHttpInfo($path_string, $path_integer, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testsPathStringPathStringIntegerPathIntegerWithHttpInfo
+ *
+ * Test path parameter(s)
+ *
+ * @param string $path_string (required)
+ * @param int $path_integer (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testsPathStringPathStringIntegerPathInteger'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testsPathStringPathStringIntegerPathIntegerWithHttpInfo($path_string, $path_integer, string $contentType = self::contentTypes['testsPathStringPathStringIntegerPathInteger'][0])
+ {
+ $request = $this->testsPathStringPathStringIntegerPathIntegerRequest($path_string, $path_integer, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('string' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testsPathStringPathStringIntegerPathIntegerAsync
+ *
+ * Test path parameter(s)
+ *
+ * @param string $path_string (required)
+ * @param int $path_integer (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testsPathStringPathStringIntegerPathInteger'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testsPathStringPathStringIntegerPathIntegerAsync($path_string, $path_integer, string $contentType = self::contentTypes['testsPathStringPathStringIntegerPathInteger'][0])
+ {
+ return $this->testsPathStringPathStringIntegerPathIntegerAsyncWithHttpInfo($path_string, $path_integer, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testsPathStringPathStringIntegerPathIntegerAsyncWithHttpInfo
+ *
+ * Test path parameter(s)
+ *
+ * @param string $path_string (required)
+ * @param int $path_integer (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testsPathStringPathStringIntegerPathInteger'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testsPathStringPathStringIntegerPathIntegerAsyncWithHttpInfo($path_string, $path_integer, string $contentType = self::contentTypes['testsPathStringPathStringIntegerPathInteger'][0])
+ {
+ $returnType = 'string';
+ $request = $this->testsPathStringPathStringIntegerPathIntegerRequest($path_string, $path_integer, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testsPathStringPathStringIntegerPathInteger'
+ *
+ * @param string $path_string (required)
+ * @param int $path_integer (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testsPathStringPathStringIntegerPathInteger'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testsPathStringPathStringIntegerPathIntegerRequest($path_string, $path_integer, string $contentType = self::contentTypes['testsPathStringPathStringIntegerPathInteger'][0])
+ {
+
+ // verify the required parameter 'path_string' is set
+ if ($path_string === null || (is_array($path_string) && count($path_string) === 0)) {
+ throw new \InvalidArgumentException(
+ 'Missing the required parameter $path_string when calling testsPathStringPathStringIntegerPathInteger'
+ );
+ }
+
+ // verify the required parameter 'path_integer' is set
+ if ($path_integer === null || (is_array($path_integer) && count($path_integer) === 0)) {
+ throw new \InvalidArgumentException(
+ 'Missing the required parameter $path_integer when calling testsPathStringPathStringIntegerPathInteger'
+ );
+ }
+
+
+ $resourcePath = '/path/string/{path_string}/integer/{path_integer}';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($path_string !== null) {
+ $resourcePath = str_replace(
+ '{' . 'path_string' . '}',
+ ObjectSerializer::toPathValue($path_string),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($path_integer !== null) {
+ $resourcePath = str_replace(
+ '{' . 'path_integer' . '}',
+ ObjectSerializer::toPathValue($path_integer),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Create http client option
+ *
+ * @throws \RuntimeException on file opening failure
+ * @return array of http client options
+ */
+ protected function createHttpClientOption()
+ {
+ $options = [];
+ if ($this->config->getDebug()) {
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
+ if (!$options[RequestOptions::DEBUG]) {
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
+ }
+ }
+
+ return $options;
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen/src/Api/QueryApi.php b/samples/client/echo_api/php-nextgen/src/Api/QueryApi.php
new file mode 100644
index 00000000000..45e2df0f3fb
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/src/Api/QueryApi.php
@@ -0,0 +1,2449 @@
+ [
+ 'application/json',
+ ],
+ 'testQueryDatetimeDateString' => [
+ 'application/json',
+ ],
+ 'testQueryIntegerBooleanString' => [
+ 'application/json',
+ ],
+ 'testQueryStyleDeepObjectExplodeTrueObject' => [
+ 'application/json',
+ ],
+ 'testQueryStyleDeepObjectExplodeTrueObjectAllOf' => [
+ 'application/json',
+ ],
+ 'testQueryStyleFormExplodeTrueArrayString' => [
+ 'application/json',
+ ],
+ 'testQueryStyleFormExplodeTrueObject' => [
+ 'application/json',
+ ],
+ 'testQueryStyleFormExplodeTrueObjectAllOf' => [
+ 'application/json',
+ ],
+ ];
+
+/**
+ * @param ClientInterface $client
+ * @param Configuration $config
+ * @param HeaderSelector $selector
+ * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
+ */
+ public function __construct(
+ ClientInterface $client = null,
+ Configuration $config = null,
+ HeaderSelector $selector = null,
+ $hostIndex = 0
+ ) {
+ $this->client = $client ?: new Client();
+ $this->config = $config ?: new Configuration();
+ $this->headerSelector = $selector ?: new HeaderSelector();
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Set the host index
+ *
+ * @param int $hostIndex Host index (required)
+ */
+ public function setHostIndex($hostIndex): void
+ {
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Get the host index
+ *
+ * @return int Host index
+ */
+ public function getHostIndex()
+ {
+ return $this->hostIndex;
+ }
+
+ /**
+ * @return Configuration
+ */
+ public function getConfig()
+ {
+ return $this->config;
+ }
+
+ /**
+ * Operation testEnumRefString
+ *
+ * Test query parameter(s)
+ *
+ * @param StringEnumRef $enum_ref_string_query enum_ref_string_query (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEnumRefString'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return string
+ */
+ public function testEnumRefString($enum_ref_string_query = null, string $contentType = self::contentTypes['testEnumRefString'][0])
+ {
+ list($response) = $this->testEnumRefStringWithHttpInfo($enum_ref_string_query, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testEnumRefStringWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param StringEnumRef $enum_ref_string_query (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEnumRefString'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testEnumRefStringWithHttpInfo($enum_ref_string_query = null, string $contentType = self::contentTypes['testEnumRefString'][0])
+ {
+ $request = $this->testEnumRefStringRequest($enum_ref_string_query, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('string' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testEnumRefStringAsync
+ *
+ * Test query parameter(s)
+ *
+ * @param StringEnumRef $enum_ref_string_query (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEnumRefString'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testEnumRefStringAsync($enum_ref_string_query = null, string $contentType = self::contentTypes['testEnumRefString'][0])
+ {
+ return $this->testEnumRefStringAsyncWithHttpInfo($enum_ref_string_query, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testEnumRefStringAsyncWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param StringEnumRef $enum_ref_string_query (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEnumRefString'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testEnumRefStringAsyncWithHttpInfo($enum_ref_string_query = null, string $contentType = self::contentTypes['testEnumRefString'][0])
+ {
+ $returnType = 'string';
+ $request = $this->testEnumRefStringRequest($enum_ref_string_query, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testEnumRefString'
+ *
+ * @param StringEnumRef $enum_ref_string_query (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEnumRefString'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testEnumRefStringRequest($enum_ref_string_query = null, string $contentType = self::contentTypes['testEnumRefString'][0])
+ {
+
+
+
+ $resourcePath = '/query/enum_ref_string';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $enum_ref_string_query,
+ 'enum_ref_string_query', // param base name
+ 'StringEnumRef', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testQueryDatetimeDateString
+ *
+ * Test query parameter(s)
+ *
+ * @param \DateTime $datetime_query datetime_query (optional)
+ * @param \DateTime $date_query date_query (optional)
+ * @param string $string_query string_query (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryDatetimeDateString'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return string
+ */
+ public function testQueryDatetimeDateString($datetime_query = null, $date_query = null, $string_query = null, string $contentType = self::contentTypes['testQueryDatetimeDateString'][0])
+ {
+ list($response) = $this->testQueryDatetimeDateStringWithHttpInfo($datetime_query, $date_query, $string_query, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testQueryDatetimeDateStringWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param \DateTime $datetime_query (optional)
+ * @param \DateTime $date_query (optional)
+ * @param string $string_query (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryDatetimeDateString'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testQueryDatetimeDateStringWithHttpInfo($datetime_query = null, $date_query = null, $string_query = null, string $contentType = self::contentTypes['testQueryDatetimeDateString'][0])
+ {
+ $request = $this->testQueryDatetimeDateStringRequest($datetime_query, $date_query, $string_query, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('string' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testQueryDatetimeDateStringAsync
+ *
+ * Test query parameter(s)
+ *
+ * @param \DateTime $datetime_query (optional)
+ * @param \DateTime $date_query (optional)
+ * @param string $string_query (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryDatetimeDateString'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testQueryDatetimeDateStringAsync($datetime_query = null, $date_query = null, $string_query = null, string $contentType = self::contentTypes['testQueryDatetimeDateString'][0])
+ {
+ return $this->testQueryDatetimeDateStringAsyncWithHttpInfo($datetime_query, $date_query, $string_query, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testQueryDatetimeDateStringAsyncWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param \DateTime $datetime_query (optional)
+ * @param \DateTime $date_query (optional)
+ * @param string $string_query (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryDatetimeDateString'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testQueryDatetimeDateStringAsyncWithHttpInfo($datetime_query = null, $date_query = null, $string_query = null, string $contentType = self::contentTypes['testQueryDatetimeDateString'][0])
+ {
+ $returnType = 'string';
+ $request = $this->testQueryDatetimeDateStringRequest($datetime_query, $date_query, $string_query, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testQueryDatetimeDateString'
+ *
+ * @param \DateTime $datetime_query (optional)
+ * @param \DateTime $date_query (optional)
+ * @param string $string_query (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryDatetimeDateString'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testQueryDatetimeDateStringRequest($datetime_query = null, $date_query = null, $string_query = null, string $contentType = self::contentTypes['testQueryDatetimeDateString'][0])
+ {
+
+
+
+
+
+ $resourcePath = '/query/datetime/date/string';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $datetime_query,
+ 'datetime_query', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $date_query,
+ 'date_query', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $string_query,
+ 'string_query', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testQueryIntegerBooleanString
+ *
+ * Test query parameter(s)
+ *
+ * @param int $integer_query integer_query (optional)
+ * @param bool $boolean_query boolean_query (optional)
+ * @param string $string_query string_query (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryIntegerBooleanString'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return string
+ */
+ public function testQueryIntegerBooleanString($integer_query = null, $boolean_query = null, $string_query = null, string $contentType = self::contentTypes['testQueryIntegerBooleanString'][0])
+ {
+ list($response) = $this->testQueryIntegerBooleanStringWithHttpInfo($integer_query, $boolean_query, $string_query, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testQueryIntegerBooleanStringWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param int $integer_query (optional)
+ * @param bool $boolean_query (optional)
+ * @param string $string_query (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryIntegerBooleanString'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testQueryIntegerBooleanStringWithHttpInfo($integer_query = null, $boolean_query = null, $string_query = null, string $contentType = self::contentTypes['testQueryIntegerBooleanString'][0])
+ {
+ $request = $this->testQueryIntegerBooleanStringRequest($integer_query, $boolean_query, $string_query, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('string' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testQueryIntegerBooleanStringAsync
+ *
+ * Test query parameter(s)
+ *
+ * @param int $integer_query (optional)
+ * @param bool $boolean_query (optional)
+ * @param string $string_query (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryIntegerBooleanString'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testQueryIntegerBooleanStringAsync($integer_query = null, $boolean_query = null, $string_query = null, string $contentType = self::contentTypes['testQueryIntegerBooleanString'][0])
+ {
+ return $this->testQueryIntegerBooleanStringAsyncWithHttpInfo($integer_query, $boolean_query, $string_query, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testQueryIntegerBooleanStringAsyncWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param int $integer_query (optional)
+ * @param bool $boolean_query (optional)
+ * @param string $string_query (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryIntegerBooleanString'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testQueryIntegerBooleanStringAsyncWithHttpInfo($integer_query = null, $boolean_query = null, $string_query = null, string $contentType = self::contentTypes['testQueryIntegerBooleanString'][0])
+ {
+ $returnType = 'string';
+ $request = $this->testQueryIntegerBooleanStringRequest($integer_query, $boolean_query, $string_query, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testQueryIntegerBooleanString'
+ *
+ * @param int $integer_query (optional)
+ * @param bool $boolean_query (optional)
+ * @param string $string_query (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryIntegerBooleanString'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testQueryIntegerBooleanStringRequest($integer_query = null, $boolean_query = null, $string_query = null, string $contentType = self::contentTypes['testQueryIntegerBooleanString'][0])
+ {
+
+
+
+
+
+ $resourcePath = '/query/integer/boolean/string';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $integer_query,
+ 'integer_query', // param base name
+ 'integer', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $boolean_query,
+ 'boolean_query', // param base name
+ 'boolean', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $string_query,
+ 'string_query', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testQueryStyleDeepObjectExplodeTrueObject
+ *
+ * Test query parameter(s)
+ *
+ * @param Pet $query_object query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return string
+ */
+ public function testQueryStyleDeepObjectExplodeTrueObject($query_object = null, string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'][0])
+ {
+ list($response) = $this->testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo($query_object, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param Pet $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo($query_object = null, string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'][0])
+ {
+ $request = $this->testQueryStyleDeepObjectExplodeTrueObjectRequest($query_object, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('string' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testQueryStyleDeepObjectExplodeTrueObjectAsync
+ *
+ * Test query parameter(s)
+ *
+ * @param Pet $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testQueryStyleDeepObjectExplodeTrueObjectAsync($query_object = null, string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'][0])
+ {
+ return $this->testQueryStyleDeepObjectExplodeTrueObjectAsyncWithHttpInfo($query_object, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testQueryStyleDeepObjectExplodeTrueObjectAsyncWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param Pet $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testQueryStyleDeepObjectExplodeTrueObjectAsyncWithHttpInfo($query_object = null, string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'][0])
+ {
+ $returnType = 'string';
+ $request = $this->testQueryStyleDeepObjectExplodeTrueObjectRequest($query_object, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testQueryStyleDeepObjectExplodeTrueObject'
+ *
+ * @param Pet $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testQueryStyleDeepObjectExplodeTrueObjectRequest($query_object = null, string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'][0])
+ {
+
+
+
+ $resourcePath = '/query/style_deepObject/explode_true/object';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $query_object,
+ 'query_object', // param base name
+ 'object', // openApiType
+ 'deepObject', // style
+ true, // explode
+ false // required
+ ) ?? []);
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testQueryStyleDeepObjectExplodeTrueObjectAllOf
+ *
+ * Test query parameter(s)
+ *
+ * @param TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter $query_object query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return string
+ */
+ public function testQueryStyleDeepObjectExplodeTrueObjectAllOf($query_object = null, string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'][0])
+ {
+ list($response) = $this->testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo($query_object, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo($query_object = null, string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'][0])
+ {
+ $request = $this->testQueryStyleDeepObjectExplodeTrueObjectAllOfRequest($query_object, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('string' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testQueryStyleDeepObjectExplodeTrueObjectAllOfAsync
+ *
+ * Test query parameter(s)
+ *
+ * @param TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testQueryStyleDeepObjectExplodeTrueObjectAllOfAsync($query_object = null, string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'][0])
+ {
+ return $this->testQueryStyleDeepObjectExplodeTrueObjectAllOfAsyncWithHttpInfo($query_object, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testQueryStyleDeepObjectExplodeTrueObjectAllOfAsyncWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testQueryStyleDeepObjectExplodeTrueObjectAllOfAsyncWithHttpInfo($query_object = null, string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'][0])
+ {
+ $returnType = 'string';
+ $request = $this->testQueryStyleDeepObjectExplodeTrueObjectAllOfRequest($query_object, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testQueryStyleDeepObjectExplodeTrueObjectAllOf'
+ *
+ * @param TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testQueryStyleDeepObjectExplodeTrueObjectAllOfRequest($query_object = null, string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'][0])
+ {
+
+
+
+ $resourcePath = '/query/style_deepObject/explode_true/object/allOf';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $query_object,
+ 'query_object', // param base name
+ 'Bird', // openApiType
+ 'deepObject', // style
+ true, // explode
+ false // required
+ ) ?? []);
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeTrueArrayString
+ *
+ * Test query parameter(s)
+ *
+ * @param TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter $query_object query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueArrayString'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return string
+ */
+ public function testQueryStyleFormExplodeTrueArrayString($query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueArrayString'][0])
+ {
+ list($response) = $this->testQueryStyleFormExplodeTrueArrayStringWithHttpInfo($query_object, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeTrueArrayStringWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueArrayString'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testQueryStyleFormExplodeTrueArrayStringWithHttpInfo($query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueArrayString'][0])
+ {
+ $request = $this->testQueryStyleFormExplodeTrueArrayStringRequest($query_object, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('string' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeTrueArrayStringAsync
+ *
+ * Test query parameter(s)
+ *
+ * @param TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueArrayString'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testQueryStyleFormExplodeTrueArrayStringAsync($query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueArrayString'][0])
+ {
+ return $this->testQueryStyleFormExplodeTrueArrayStringAsyncWithHttpInfo($query_object, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeTrueArrayStringAsyncWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueArrayString'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testQueryStyleFormExplodeTrueArrayStringAsyncWithHttpInfo($query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueArrayString'][0])
+ {
+ $returnType = 'string';
+ $request = $this->testQueryStyleFormExplodeTrueArrayStringRequest($query_object, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testQueryStyleFormExplodeTrueArrayString'
+ *
+ * @param TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueArrayString'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testQueryStyleFormExplodeTrueArrayStringRequest($query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueArrayString'][0])
+ {
+
+
+
+ $resourcePath = '/query/style_form/explode_true/array_string';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $query_object,
+ 'query_object', // param base name
+ 'object', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeTrueObject
+ *
+ * Test query parameter(s)
+ *
+ * @param Pet $query_object query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueObject'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return string
+ */
+ public function testQueryStyleFormExplodeTrueObject($query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObject'][0])
+ {
+ list($response) = $this->testQueryStyleFormExplodeTrueObjectWithHttpInfo($query_object, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeTrueObjectWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param Pet $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueObject'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testQueryStyleFormExplodeTrueObjectWithHttpInfo($query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObject'][0])
+ {
+ $request = $this->testQueryStyleFormExplodeTrueObjectRequest($query_object, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('string' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeTrueObjectAsync
+ *
+ * Test query parameter(s)
+ *
+ * @param Pet $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueObject'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testQueryStyleFormExplodeTrueObjectAsync($query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObject'][0])
+ {
+ return $this->testQueryStyleFormExplodeTrueObjectAsyncWithHttpInfo($query_object, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeTrueObjectAsyncWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param Pet $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueObject'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testQueryStyleFormExplodeTrueObjectAsyncWithHttpInfo($query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObject'][0])
+ {
+ $returnType = 'string';
+ $request = $this->testQueryStyleFormExplodeTrueObjectRequest($query_object, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testQueryStyleFormExplodeTrueObject'
+ *
+ * @param Pet $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueObject'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testQueryStyleFormExplodeTrueObjectRequest($query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObject'][0])
+ {
+
+
+
+ $resourcePath = '/query/style_form/explode_true/object';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $query_object,
+ 'query_object', // param base name
+ 'object', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeTrueObjectAllOf
+ *
+ * Test query parameter(s)
+ *
+ * @param DataQuery $query_object query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return string
+ */
+ public function testQueryStyleFormExplodeTrueObjectAllOf($query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'][0])
+ {
+ list($response) = $this->testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo($query_object, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param DataQuery $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'] to see the possible values for this operation
+ *
+ * @throws \OpenAPI\Client\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of string, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo($query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'][0])
+ {
+ $request = $this->testQueryStyleFormExplodeTrueObjectAllOfRequest($query_object, $contentType);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('string' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('string' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, 'string', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = 'string';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ 'string',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeTrueObjectAllOfAsync
+ *
+ * Test query parameter(s)
+ *
+ * @param DataQuery $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testQueryStyleFormExplodeTrueObjectAllOfAsync($query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'][0])
+ {
+ return $this->testQueryStyleFormExplodeTrueObjectAllOfAsyncWithHttpInfo($query_object, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation testQueryStyleFormExplodeTrueObjectAllOfAsyncWithHttpInfo
+ *
+ * Test query parameter(s)
+ *
+ * @param DataQuery $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function testQueryStyleFormExplodeTrueObjectAllOfAsyncWithHttpInfo($query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'][0])
+ {
+ $returnType = 'string';
+ $request = $this->testQueryStyleFormExplodeTrueObjectAllOfRequest($query_object, $contentType);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'testQueryStyleFormExplodeTrueObjectAllOf'
+ *
+ * @param DataQuery $query_object (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function testQueryStyleFormExplodeTrueObjectAllOfRequest($query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'][0])
+ {
+
+
+
+ $resourcePath = '/query/style_form/explode_true/object/allOf';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $query_object,
+ 'query_object', // param base name
+ 'object', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['text/plain', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return new Request(
+ 'GET',
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ );
+ }
+
+ /**
+ * Create http client option
+ *
+ * @throws \RuntimeException on file opening failure
+ * @return array of http client options
+ */
+ protected function createHttpClientOption()
+ {
+ $options = [];
+ if ($this->config->getDebug()) {
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
+ if (!$options[RequestOptions::DEBUG]) {
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
+ }
+ }
+
+ return $options;
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen/src/ApiException.php b/samples/client/echo_api/php-nextgen/src/ApiException.php
new file mode 100644
index 00000000000..2c3b6e48dbb
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/src/ApiException.php
@@ -0,0 +1,120 @@
+responseHeaders = $responseHeaders;
+ $this->responseBody = $responseBody;
+ }
+
+ /**
+ * Gets the HTTP response header
+ *
+ * @return string[]|null HTTP response header
+ */
+ public function getResponseHeaders()
+ {
+ return $this->responseHeaders;
+ }
+
+ /**
+ * Gets the HTTP body of the server response either as Json or string
+ *
+ * @return \stdClass|string|null HTTP body of the server response either as \stdClass or string
+ */
+ public function getResponseBody()
+ {
+ return $this->responseBody;
+ }
+
+ /**
+ * Sets the deserialized response object (during deserialization)
+ *
+ * @param mixed $obj Deserialized response object
+ *
+ * @return void
+ */
+ public function setResponseObject($obj)
+ {
+ $this->responseObject = $obj;
+ }
+
+ /**
+ * Gets the deserialized response object (during deserialization)
+ *
+ * @return mixed the deserialized response object
+ */
+ public function getResponseObject()
+ {
+ return $this->responseObject;
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen/src/Configuration.php b/samples/client/echo_api/php-nextgen/src/Configuration.php
new file mode 100644
index 00000000000..ffb22a3cbeb
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/src/Configuration.php
@@ -0,0 +1,531 @@
+tempFolderPath = sys_get_temp_dir();
+ }
+
+ /**
+ * Sets API key
+ *
+ * @param string $apiKeyIdentifier API key identifier (authentication scheme)
+ * @param string $key API key or token
+ *
+ * @return $this
+ */
+ public function setApiKey($apiKeyIdentifier, $key)
+ {
+ $this->apiKeys[$apiKeyIdentifier] = $key;
+ return $this;
+ }
+
+ /**
+ * Gets API key
+ *
+ * @param string $apiKeyIdentifier API key identifier (authentication scheme)
+ *
+ * @return null|string API key or token
+ */
+ public function getApiKey($apiKeyIdentifier)
+ {
+ return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null;
+ }
+
+ /**
+ * Sets the prefix for API key (e.g. Bearer)
+ *
+ * @param string $apiKeyIdentifier API key identifier (authentication scheme)
+ * @param string $prefix API key prefix, e.g. Bearer
+ *
+ * @return $this
+ */
+ public function setApiKeyPrefix($apiKeyIdentifier, $prefix)
+ {
+ $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix;
+ return $this;
+ }
+
+ /**
+ * Gets API key prefix
+ *
+ * @param string $apiKeyIdentifier API key identifier (authentication scheme)
+ *
+ * @return null|string
+ */
+ public function getApiKeyPrefix($apiKeyIdentifier)
+ {
+ return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null;
+ }
+
+ /**
+ * Sets the access token for OAuth
+ *
+ * @param string $accessToken Token for OAuth
+ *
+ * @return $this
+ */
+ public function setAccessToken($accessToken)
+ {
+ $this->accessToken = $accessToken;
+ return $this;
+ }
+
+ /**
+ * Gets the access token for OAuth
+ *
+ * @return string Access token for OAuth
+ */
+ public function getAccessToken()
+ {
+ return $this->accessToken;
+ }
+
+ /**
+ * Sets boolean format for query string.
+ *
+ * @param string $booleanFormatForQueryString Boolean format for query string
+ *
+ * @return $this
+ */
+ public function setBooleanFormatForQueryString(string $booleanFormat)
+ {
+ $this->booleanFormatForQueryString = $booleanFormat;
+
+ return $this;
+ }
+
+ /**
+ * Gets boolean format for query string.
+ *
+ * @return string Boolean format for query string
+ */
+ public function getBooleanFormatForQueryString(): string
+ {
+ return $this->booleanFormatForQueryString;
+ }
+
+ /**
+ * Sets the username for HTTP basic authentication
+ *
+ * @param string $username Username for HTTP basic authentication
+ *
+ * @return $this
+ */
+ public function setUsername($username)
+ {
+ $this->username = $username;
+ return $this;
+ }
+
+ /**
+ * Gets the username for HTTP basic authentication
+ *
+ * @return string Username for HTTP basic authentication
+ */
+ public function getUsername()
+ {
+ return $this->username;
+ }
+
+ /**
+ * Sets the password for HTTP basic authentication
+ *
+ * @param string $password Password for HTTP basic authentication
+ *
+ * @return $this
+ */
+ public function setPassword($password)
+ {
+ $this->password = $password;
+ return $this;
+ }
+
+ /**
+ * Gets the password for HTTP basic authentication
+ *
+ * @return string Password for HTTP basic authentication
+ */
+ public function getPassword()
+ {
+ return $this->password;
+ }
+
+ /**
+ * Sets the host
+ *
+ * @param string $host Host
+ *
+ * @return $this
+ */
+ public function setHost($host)
+ {
+ $this->host = $host;
+ return $this;
+ }
+
+ /**
+ * Gets the host
+ *
+ * @return string Host
+ */
+ public function getHost()
+ {
+ return $this->host;
+ }
+
+ /**
+ * Sets the user agent of the api client
+ *
+ * @param string $userAgent the user agent of the api client
+ *
+ * @throws \InvalidArgumentException
+ * @return $this
+ */
+ public function setUserAgent($userAgent)
+ {
+ if (!is_string($userAgent)) {
+ throw new \InvalidArgumentException('User-agent must be a string.');
+ }
+
+ $this->userAgent = $userAgent;
+ return $this;
+ }
+
+ /**
+ * Gets the user agent of the api client
+ *
+ * @return string user agent
+ */
+ public function getUserAgent()
+ {
+ return $this->userAgent;
+ }
+
+ /**
+ * Sets debug flag
+ *
+ * @param bool $debug Debug flag
+ *
+ * @return $this
+ */
+ public function setDebug($debug)
+ {
+ $this->debug = $debug;
+ return $this;
+ }
+
+ /**
+ * Gets the debug flag
+ *
+ * @return bool
+ */
+ public function getDebug()
+ {
+ return $this->debug;
+ }
+
+ /**
+ * Sets the debug file
+ *
+ * @param string $debugFile Debug file
+ *
+ * @return $this
+ */
+ public function setDebugFile($debugFile)
+ {
+ $this->debugFile = $debugFile;
+ return $this;
+ }
+
+ /**
+ * Gets the debug file
+ *
+ * @return string
+ */
+ public function getDebugFile()
+ {
+ return $this->debugFile;
+ }
+
+ /**
+ * Sets the temp folder path
+ *
+ * @param string $tempFolderPath Temp folder path
+ *
+ * @return $this
+ */
+ public function setTempFolderPath($tempFolderPath)
+ {
+ $this->tempFolderPath = $tempFolderPath;
+ return $this;
+ }
+
+ /**
+ * Gets the temp folder path
+ *
+ * @return string Temp folder path
+ */
+ public function getTempFolderPath()
+ {
+ return $this->tempFolderPath;
+ }
+
+ /**
+ * Gets the default configuration instance
+ *
+ * @return Configuration
+ */
+ public static function getDefaultConfiguration()
+ {
+ if (self::$defaultConfiguration === null) {
+ self::$defaultConfiguration = new Configuration();
+ }
+
+ return self::$defaultConfiguration;
+ }
+
+ /**
+ * Sets the default configuration instance
+ *
+ * @param Configuration $config An instance of the Configuration Object
+ *
+ * @return void
+ */
+ public static function setDefaultConfiguration(Configuration $config)
+ {
+ self::$defaultConfiguration = $config;
+ }
+
+ /**
+ * Gets the essential information for debugging
+ *
+ * @return string The report for debugging
+ */
+ public static function toDebugReport()
+ {
+ $report = 'PHP SDK (OpenAPI\Client) Debug Report:' . PHP_EOL;
+ $report .= ' OS: ' . php_uname() . PHP_EOL;
+ $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL;
+ $report .= ' The version of the OpenAPI document: 0.1.0' . PHP_EOL;
+ $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL;
+
+ return $report;
+ }
+
+ /**
+ * Get API key (with prefix if set)
+ *
+ * @param string $apiKeyIdentifier name of apikey
+ *
+ * @return null|string API key with the prefix
+ */
+ public function getApiKeyWithPrefix($apiKeyIdentifier)
+ {
+ $prefix = $this->getApiKeyPrefix($apiKeyIdentifier);
+ $apiKey = $this->getApiKey($apiKeyIdentifier);
+
+ if ($apiKey === null) {
+ return null;
+ }
+
+ if ($prefix === null) {
+ $keyWithPrefix = $apiKey;
+ } else {
+ $keyWithPrefix = $prefix . ' ' . $apiKey;
+ }
+
+ return $keyWithPrefix;
+ }
+
+ /**
+ * Returns an array of host settings
+ *
+ * @return array an array of host settings
+ */
+ public function getHostSettings()
+ {
+ return [
+ [
+ "url" => "http://localhost:3000",
+ "description" => "No description provided",
+ ]
+ ];
+ }
+
+ /**
+ * Returns URL based on host settings, index and variables
+ *
+ * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients
+ * @param int $hostIndex index of the host settings
+ * @param array|null $variables hash of variable and the corresponding value (optional)
+ * @return string URL based on host settings
+ */
+ public static function getHostString(array $hostsSettings, $hostIndex, array $variables = null)
+ {
+ if (null === $variables) {
+ $variables = [];
+ }
+
+ // check array index out of bound
+ if ($hostIndex < 0 || $hostIndex >= count($hostsSettings)) {
+ throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostsSettings));
+ }
+
+ $host = $hostsSettings[$hostIndex];
+ $url = $host["url"];
+
+ // go through variable and assign a value
+ foreach ($host["variables"] ?? [] as $name => $variable) {
+ if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user
+ if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum
+ $url = str_replace("{".$name."}", $variables[$name], $url);
+ } else {
+ throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"]).".");
+ }
+ } else {
+ // use default value
+ $url = str_replace("{".$name."}", $variable["default_value"], $url);
+ }
+ }
+
+ return $url;
+ }
+
+ /**
+ * Returns URL based on the index and variables
+ *
+ * @param int $index index of the host settings
+ * @param array|null $variables hash of variable and the corresponding value (optional)
+ * @return string URL based on host settings
+ */
+ public function getHostFromSettings($index, $variables = null)
+ {
+ return self::getHostString($this->getHostSettings(), $index, $variables);
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen/src/HeaderSelector.php b/samples/client/echo_api/php-nextgen/src/HeaderSelector.php
new file mode 100644
index 00000000000..de00e44e715
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/src/HeaderSelector.php
@@ -0,0 +1,246 @@
+selectAcceptHeader($accept);
+ if ($accept !== null) {
+ $headers['Accept'] = $accept;
+ }
+
+ if (!$isMultipart) {
+ if($contentType === '') {
+ $contentType = 'application/json';
+ }
+
+ $headers['Content-Type'] = $contentType;
+ }
+
+ return $headers;
+ }
+
+ /**
+ * Return the header 'Accept' based on an array of Accept provided.
+ *
+ * @param string[] $accept Array of header
+ *
+ * @return null|string Accept (e.g. application/json)
+ */
+ private function selectAcceptHeader(array $accept): ?string
+ {
+ # filter out empty entries
+ $accept = array_filter($accept);
+
+ if (count($accept) === 0) {
+ return null;
+ }
+
+ # If there's only one Accept header, just use it
+ if (count($accept) === 1) {
+ return reset($accept);
+ }
+
+ # If none of the available Accept headers is of type "json", then just use all them
+ $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept);
+ if (count($headersWithJson) === 0) {
+ return implode(',', $accept);
+ }
+
+ # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1,
+ # to give the highest priority to json-like headers - recalculating the existing ones, if needed
+ return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson);
+ }
+
+ /**
+ * Create an Accept header string from the given "Accept" headers array, recalculating all weights
+ *
+ * @param string[] $accept Array of Accept Headers
+ * @param string[] $headersWithJson Array of Accept Headers of type "json"
+ *
+ * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9")
+ */
+ private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string
+ {
+ $processedHeaders = [
+ 'withApplicationJson' => [],
+ 'withJson' => [],
+ 'withoutJson' => [],
+ ];
+
+ foreach ($accept as $header) {
+
+ $headerData = $this->getHeaderAndWeight($header);
+
+ if (stripos($headerData['header'], 'application/json') === 0) {
+ $processedHeaders['withApplicationJson'][] = $headerData;
+ } elseif (in_array($header, $headersWithJson, true)) {
+ $processedHeaders['withJson'][] = $headerData;
+ } else {
+ $processedHeaders['withoutJson'][] = $headerData;
+ }
+ }
+
+ $acceptHeaders = [];
+ $currentWeight = 1000;
+
+ $hasMoreThan28Headers = count($accept) > 28;
+
+ foreach($processedHeaders as $headers) {
+ if (count($headers) > 0) {
+ $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers);
+ }
+ }
+
+ $acceptHeaders = array_merge(...$acceptHeaders);
+
+ return implode(',', $acceptHeaders);
+ }
+
+ /**
+ * Given an Accept header, returns an associative array splitting the header and its weight
+ *
+ * @param string $header "Accept" Header
+ *
+ * @return array with the header and its weight
+ */
+ private function getHeaderAndWeight(string $header): array
+ {
+ # matches headers with weight, splitting the header and the weight in $outputArray
+ if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) {
+ $headerData = [
+ 'header' => $outputArray[1],
+ 'weight' => (int)($outputArray[2] * 1000),
+ ];
+ } else {
+ $headerData = [
+ 'header' => trim($header),
+ 'weight' => 1000,
+ ];
+ }
+
+ return $headerData;
+ }
+
+ /**
+ * @param array[] $headers
+ * @param float $currentWeight
+ * @param bool $hasMoreThan28Headers
+ * @return string[] array of adjusted "Accept" headers
+ */
+ private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array
+ {
+ usort($headers, function (array $a, array $b) {
+ return $b['weight'] - $a['weight'];
+ });
+
+ $acceptHeaders = [];
+ foreach ($headers as $index => $header) {
+ if($index > 0 && $headers[$index - 1]['weight'] > $header['weight'])
+ {
+ $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers);
+ }
+
+ $weight = $currentWeight;
+
+ $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight);
+ }
+
+ $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers);
+
+ return $acceptHeaders;
+ }
+
+ /**
+ * @param string $header
+ * @param int $weight
+ * @return string
+ */
+ private function buildAcceptHeader(string $header, int $weight): string
+ {
+ if($weight === 1000) {
+ return $header;
+ }
+
+ return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0');
+ }
+
+ /**
+ * Calculate the next weight, based on the current one.
+ *
+ * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the
+ * following formula:
+ *
+ * next weight = current weight - 10 ^ (floor(log(current weight - 1)))
+ *
+ * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) )
+ *
+ * Starting from 1000, this generates the following series:
+ *
+ * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
+ *
+ * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works
+ * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1
+ * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc.
+ *
+ * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value)
+ * @param bool $hasMoreThan28Headers
+ * @return int
+ */
+ public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int
+ {
+ if ($currentWeight <= 1) {
+ return 1;
+ }
+
+ if ($hasMoreThan28Headers) {
+ return $currentWeight - 1;
+ }
+
+ return $currentWeight - 10 ** floor( log10($currentWeight - 1) );
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen/src/Model/Bird.php b/samples/client/echo_api/php-nextgen/src/Model/Bird.php
new file mode 100644
index 00000000000..78c6e208fc1
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/src/Model/Bird.php
@@ -0,0 +1,444 @@
+
+ */
+class Bird implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'Bird';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'size' => 'string',
+ 'color' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'size' => null,
+ 'color' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'size' => false,
+ 'color' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'size' => 'size',
+ 'color' => 'color'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'size' => 'setSize',
+ 'color' => 'setColor'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'size' => 'getSize',
+ 'color' => 'getColor'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('size', $data ?? [], null);
+ $this->setIfExists('color', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets size
+ *
+ * @return string|null
+ */
+ public function getSize()
+ {
+ return $this->container['size'];
+ }
+
+ /**
+ * Sets size
+ *
+ * @param string|null $size size
+ *
+ * @return self
+ */
+ public function setSize($size)
+ {
+ if (is_null($size)) {
+ throw new \InvalidArgumentException('non-nullable size cannot be null');
+ }
+ $this->container['size'] = $size;
+
+ return $this;
+ }
+
+ /**
+ * Gets color
+ *
+ * @return string|null
+ */
+ public function getColor()
+ {
+ return $this->container['color'];
+ }
+
+ /**
+ * Sets color
+ *
+ * @param string|null $color color
+ *
+ * @return self
+ */
+ public function setColor($color)
+ {
+ if (is_null($color)) {
+ throw new \InvalidArgumentException('non-nullable color cannot be null');
+ }
+ $this->container['color'] = $color;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/samples/client/echo_api/php-nextgen/src/Model/Category.php b/samples/client/echo_api/php-nextgen/src/Model/Category.php
new file mode 100644
index 00000000000..c33e03307b6
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/src/Model/Category.php
@@ -0,0 +1,444 @@
+
+ */
+class Category implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'Category';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'id' => 'int',
+ 'name' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'id' => 'int64',
+ 'name' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'id' => false,
+ 'name' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'id' => 'id',
+ 'name' => 'name'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'id' => 'setId',
+ 'name' => 'setName'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'id' => 'getId',
+ 'name' => 'getName'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('id', $data ?? [], null);
+ $this->setIfExists('name', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets id
+ *
+ * @return int|null
+ */
+ public function getId()
+ {
+ return $this->container['id'];
+ }
+
+ /**
+ * Sets id
+ *
+ * @param int|null $id id
+ *
+ * @return self
+ */
+ public function setId($id)
+ {
+ if (is_null($id)) {
+ throw new \InvalidArgumentException('non-nullable id cannot be null');
+ }
+ $this->container['id'] = $id;
+
+ return $this;
+ }
+
+ /**
+ * Gets name
+ *
+ * @return string|null
+ */
+ public function getName()
+ {
+ return $this->container['name'];
+ }
+
+ /**
+ * Sets name
+ *
+ * @param string|null $name name
+ *
+ * @return self
+ */
+ public function setName($name)
+ {
+ if (is_null($name)) {
+ throw new \InvalidArgumentException('non-nullable name cannot be null');
+ }
+ $this->container['name'] = $name;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/samples/client/echo_api/php-nextgen/src/Model/DataQuery.php b/samples/client/echo_api/php-nextgen/src/Model/DataQuery.php
new file mode 100644
index 00000000000..1efa3a9e4f8
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/src/Model/DataQuery.php
@@ -0,0 +1,472 @@
+
+ */
+class DataQuery extends Query
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'DataQuery';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'suffix' => 'string',
+ 'text' => 'string',
+ 'date' => '\DateTime'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'suffix' => null,
+ 'text' => null,
+ 'date' => 'date-time'
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'suffix' => false,
+ 'text' => false,
+ 'date' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes + parent::openAPITypes();
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats + parent::openAPIFormats();
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables + parent::openAPINullables();
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'suffix' => 'suffix',
+ 'text' => 'text',
+ 'date' => 'date'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'suffix' => 'setSuffix',
+ 'text' => 'setText',
+ 'date' => 'setDate'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'suffix' => 'getSuffix',
+ 'text' => 'getText',
+ 'date' => 'getDate'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return parent::attributeMap() + self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return parent::setters() + self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return parent::getters() + self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ parent::__construct($data);
+
+ $this->setIfExists('suffix', $data ?? [], null);
+ $this->setIfExists('text', $data ?? [], null);
+ $this->setIfExists('date', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = parent::listInvalidProperties();
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets suffix
+ *
+ * @return string|null
+ */
+ public function getSuffix()
+ {
+ return $this->container['suffix'];
+ }
+
+ /**
+ * Sets suffix
+ *
+ * @param string|null $suffix test suffix
+ *
+ * @return self
+ */
+ public function setSuffix($suffix)
+ {
+ if (is_null($suffix)) {
+ throw new \InvalidArgumentException('non-nullable suffix cannot be null');
+ }
+ $this->container['suffix'] = $suffix;
+
+ return $this;
+ }
+
+ /**
+ * Gets text
+ *
+ * @return string|null
+ */
+ public function getText()
+ {
+ return $this->container['text'];
+ }
+
+ /**
+ * Sets text
+ *
+ * @param string|null $text Some text containing white spaces
+ *
+ * @return self
+ */
+ public function setText($text)
+ {
+ if (is_null($text)) {
+ throw new \InvalidArgumentException('non-nullable text cannot be null');
+ }
+ $this->container['text'] = $text;
+
+ return $this;
+ }
+
+ /**
+ * Gets date
+ *
+ * @return \DateTime|null
+ */
+ public function getDate()
+ {
+ return $this->container['date'];
+ }
+
+ /**
+ * Sets date
+ *
+ * @param \DateTime|null $date A date
+ *
+ * @return self
+ */
+ public function setDate($date)
+ {
+ if (is_null($date)) {
+ throw new \InvalidArgumentException('non-nullable date cannot be null');
+ }
+ $this->container['date'] = $date;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/samples/client/echo_api/php-nextgen/src/Model/DefaultValue.php b/samples/client/echo_api/php-nextgen/src/Model/DefaultValue.php
new file mode 100644
index 00000000000..d11057ebada
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/src/Model/DefaultValue.php
@@ -0,0 +1,696 @@
+
+ */
+class DefaultValue implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'DefaultValue';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'array_string_enum_ref_default' => '\OpenAPI\Client\Model\StringEnumRef[]',
+ 'array_string_enum_default' => 'string[]',
+ 'array_string_default' => 'string[]',
+ 'array_integer_default' => 'int[]',
+ 'array_string' => 'string[]',
+ 'array_string_nullable' => 'string[]',
+ 'array_string_extension_nullable' => 'string[]',
+ 'string_nullable' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'array_string_enum_ref_default' => null,
+ 'array_string_enum_default' => null,
+ 'array_string_default' => null,
+ 'array_integer_default' => null,
+ 'array_string' => null,
+ 'array_string_nullable' => null,
+ 'array_string_extension_nullable' => null,
+ 'string_nullable' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'array_string_enum_ref_default' => false,
+ 'array_string_enum_default' => false,
+ 'array_string_default' => false,
+ 'array_integer_default' => false,
+ 'array_string' => false,
+ 'array_string_nullable' => true,
+ 'array_string_extension_nullable' => true,
+ 'string_nullable' => true
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'array_string_enum_ref_default' => 'array_string_enum_ref_default',
+ 'array_string_enum_default' => 'array_string_enum_default',
+ 'array_string_default' => 'array_string_default',
+ 'array_integer_default' => 'array_integer_default',
+ 'array_string' => 'array_string',
+ 'array_string_nullable' => 'array_string_nullable',
+ 'array_string_extension_nullable' => 'array_string_extension_nullable',
+ 'string_nullable' => 'string_nullable'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'array_string_enum_ref_default' => 'setArrayStringEnumRefDefault',
+ 'array_string_enum_default' => 'setArrayStringEnumDefault',
+ 'array_string_default' => 'setArrayStringDefault',
+ 'array_integer_default' => 'setArrayIntegerDefault',
+ 'array_string' => 'setArrayString',
+ 'array_string_nullable' => 'setArrayStringNullable',
+ 'array_string_extension_nullable' => 'setArrayStringExtensionNullable',
+ 'string_nullable' => 'setStringNullable'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'array_string_enum_ref_default' => 'getArrayStringEnumRefDefault',
+ 'array_string_enum_default' => 'getArrayStringEnumDefault',
+ 'array_string_default' => 'getArrayStringDefault',
+ 'array_integer_default' => 'getArrayIntegerDefault',
+ 'array_string' => 'getArrayString',
+ 'array_string_nullable' => 'getArrayStringNullable',
+ 'array_string_extension_nullable' => 'getArrayStringExtensionNullable',
+ 'string_nullable' => 'getStringNullable'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+ public const ARRAY_STRING_ENUM_DEFAULT_SUCCESS = 'success';
+ public const ARRAY_STRING_ENUM_DEFAULT_FAILURE = 'failure';
+ public const ARRAY_STRING_ENUM_DEFAULT_UNCLASSIFIED = 'unclassified';
+
+ /**
+ * Gets allowable values of the enum
+ *
+ * @return string[]
+ */
+ public function getArrayStringEnumDefaultAllowableValues()
+ {
+ return [
+ self::ARRAY_STRING_ENUM_DEFAULT_SUCCESS,
+ self::ARRAY_STRING_ENUM_DEFAULT_FAILURE,
+ self::ARRAY_STRING_ENUM_DEFAULT_UNCLASSIFIED,
+ ];
+ }
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('array_string_enum_ref_default', $data ?? [], null);
+ $this->setIfExists('array_string_enum_default', $data ?? [], null);
+ $this->setIfExists('array_string_default', $data ?? [], null);
+ $this->setIfExists('array_integer_default', $data ?? [], null);
+ $this->setIfExists('array_string', $data ?? [], null);
+ $this->setIfExists('array_string_nullable', $data ?? [], null);
+ $this->setIfExists('array_string_extension_nullable', $data ?? [], null);
+ $this->setIfExists('string_nullable', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets array_string_enum_ref_default
+ *
+ * @return \OpenAPI\Client\Model\StringEnumRef[]|null
+ */
+ public function getArrayStringEnumRefDefault()
+ {
+ return $this->container['array_string_enum_ref_default'];
+ }
+
+ /**
+ * Sets array_string_enum_ref_default
+ *
+ * @param \OpenAPI\Client\Model\StringEnumRef[]|null $array_string_enum_ref_default array_string_enum_ref_default
+ *
+ * @return self
+ */
+ public function setArrayStringEnumRefDefault($array_string_enum_ref_default)
+ {
+ if (is_null($array_string_enum_ref_default)) {
+ throw new \InvalidArgumentException('non-nullable array_string_enum_ref_default cannot be null');
+ }
+ $this->container['array_string_enum_ref_default'] = $array_string_enum_ref_default;
+
+ return $this;
+ }
+
+ /**
+ * Gets array_string_enum_default
+ *
+ * @return string[]|null
+ */
+ public function getArrayStringEnumDefault()
+ {
+ return $this->container['array_string_enum_default'];
+ }
+
+ /**
+ * Sets array_string_enum_default
+ *
+ * @param string[]|null $array_string_enum_default array_string_enum_default
+ *
+ * @return self
+ */
+ public function setArrayStringEnumDefault($array_string_enum_default)
+ {
+ if (is_null($array_string_enum_default)) {
+ throw new \InvalidArgumentException('non-nullable array_string_enum_default cannot be null');
+ }
+ $allowedValues = $this->getArrayStringEnumDefaultAllowableValues();
+ if (array_diff($array_string_enum_default, $allowedValues)) {
+ throw new \InvalidArgumentException(
+ sprintf(
+ "Invalid value for 'array_string_enum_default', must be one of '%s'",
+ implode("', '", $allowedValues)
+ )
+ );
+ }
+ $this->container['array_string_enum_default'] = $array_string_enum_default;
+
+ return $this;
+ }
+
+ /**
+ * Gets array_string_default
+ *
+ * @return string[]|null
+ */
+ public function getArrayStringDefault()
+ {
+ return $this->container['array_string_default'];
+ }
+
+ /**
+ * Sets array_string_default
+ *
+ * @param string[]|null $array_string_default array_string_default
+ *
+ * @return self
+ */
+ public function setArrayStringDefault($array_string_default)
+ {
+ if (is_null($array_string_default)) {
+ throw new \InvalidArgumentException('non-nullable array_string_default cannot be null');
+ }
+ $this->container['array_string_default'] = $array_string_default;
+
+ return $this;
+ }
+
+ /**
+ * Gets array_integer_default
+ *
+ * @return int[]|null
+ */
+ public function getArrayIntegerDefault()
+ {
+ return $this->container['array_integer_default'];
+ }
+
+ /**
+ * Sets array_integer_default
+ *
+ * @param int[]|null $array_integer_default array_integer_default
+ *
+ * @return self
+ */
+ public function setArrayIntegerDefault($array_integer_default)
+ {
+ if (is_null($array_integer_default)) {
+ throw new \InvalidArgumentException('non-nullable array_integer_default cannot be null');
+ }
+ $this->container['array_integer_default'] = $array_integer_default;
+
+ return $this;
+ }
+
+ /**
+ * Gets array_string
+ *
+ * @return string[]|null
+ */
+ public function getArrayString()
+ {
+ return $this->container['array_string'];
+ }
+
+ /**
+ * Sets array_string
+ *
+ * @param string[]|null $array_string array_string
+ *
+ * @return self
+ */
+ public function setArrayString($array_string)
+ {
+ if (is_null($array_string)) {
+ throw new \InvalidArgumentException('non-nullable array_string cannot be null');
+ }
+ $this->container['array_string'] = $array_string;
+
+ return $this;
+ }
+
+ /**
+ * Gets array_string_nullable
+ *
+ * @return string[]|null
+ */
+ public function getArrayStringNullable()
+ {
+ return $this->container['array_string_nullable'];
+ }
+
+ /**
+ * Sets array_string_nullable
+ *
+ * @param string[]|null $array_string_nullable array_string_nullable
+ *
+ * @return self
+ */
+ public function setArrayStringNullable($array_string_nullable)
+ {
+ if (is_null($array_string_nullable)) {
+ array_push($this->openAPINullablesSetToNull, 'array_string_nullable');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('array_string_nullable', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+ $this->container['array_string_nullable'] = $array_string_nullable;
+
+ return $this;
+ }
+
+ /**
+ * Gets array_string_extension_nullable
+ *
+ * @return string[]|null
+ */
+ public function getArrayStringExtensionNullable()
+ {
+ return $this->container['array_string_extension_nullable'];
+ }
+
+ /**
+ * Sets array_string_extension_nullable
+ *
+ * @param string[]|null $array_string_extension_nullable array_string_extension_nullable
+ *
+ * @return self
+ */
+ public function setArrayStringExtensionNullable($array_string_extension_nullable)
+ {
+ if (is_null($array_string_extension_nullable)) {
+ array_push($this->openAPINullablesSetToNull, 'array_string_extension_nullable');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('array_string_extension_nullable', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+ $this->container['array_string_extension_nullable'] = $array_string_extension_nullable;
+
+ return $this;
+ }
+
+ /**
+ * Gets string_nullable
+ *
+ * @return string|null
+ */
+ public function getStringNullable()
+ {
+ return $this->container['string_nullable'];
+ }
+
+ /**
+ * Sets string_nullable
+ *
+ * @param string|null $string_nullable string_nullable
+ *
+ * @return self
+ */
+ public function setStringNullable($string_nullable)
+ {
+ if (is_null($string_nullable)) {
+ array_push($this->openAPINullablesSetToNull, 'string_nullable');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('string_nullable', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+ $this->container['string_nullable'] = $string_nullable;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/samples/client/echo_api/php-nextgen/src/Model/ModelInterface.php b/samples/client/echo_api/php-nextgen/src/Model/ModelInterface.php
new file mode 100644
index 00000000000..60e917bca3e
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/src/Model/ModelInterface.php
@@ -0,0 +1,112 @@
+
+ */
+class NumberPropertiesOnly implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'NumberPropertiesOnly';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'number' => 'float',
+ 'float' => 'float',
+ 'double' => 'float'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'number' => null,
+ 'float' => 'float',
+ 'double' => 'double'
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'number' => false,
+ 'float' => false,
+ 'double' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'number' => 'number',
+ 'float' => 'float',
+ 'double' => 'double'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'number' => 'setNumber',
+ 'float' => 'setFloat',
+ 'double' => 'setDouble'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'number' => 'getNumber',
+ 'float' => 'getFloat',
+ 'double' => 'getDouble'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('number', $data ?? [], null);
+ $this->setIfExists('float', $data ?? [], null);
+ $this->setIfExists('double', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ if (!is_null($this->container['double']) && ($this->container['double'] > 50.2)) {
+ $invalidProperties[] = "invalid value for 'double', must be smaller than or equal to 50.2.";
+ }
+
+ if (!is_null($this->container['double']) && ($this->container['double'] < 0.8)) {
+ $invalidProperties[] = "invalid value for 'double', must be bigger than or equal to 0.8.";
+ }
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets number
+ *
+ * @return float|null
+ */
+ public function getNumber()
+ {
+ return $this->container['number'];
+ }
+
+ /**
+ * Sets number
+ *
+ * @param float|null $number number
+ *
+ * @return self
+ */
+ public function setNumber($number)
+ {
+ if (is_null($number)) {
+ throw new \InvalidArgumentException('non-nullable number cannot be null');
+ }
+ $this->container['number'] = $number;
+
+ return $this;
+ }
+
+ /**
+ * Gets float
+ *
+ * @return float|null
+ */
+ public function getFloat()
+ {
+ return $this->container['float'];
+ }
+
+ /**
+ * Sets float
+ *
+ * @param float|null $float float
+ *
+ * @return self
+ */
+ public function setFloat($float)
+ {
+ if (is_null($float)) {
+ throw new \InvalidArgumentException('non-nullable float cannot be null');
+ }
+ $this->container['float'] = $float;
+
+ return $this;
+ }
+
+ /**
+ * Gets double
+ *
+ * @return float|null
+ */
+ public function getDouble()
+ {
+ return $this->container['double'];
+ }
+
+ /**
+ * Sets double
+ *
+ * @param float|null $double double
+ *
+ * @return self
+ */
+ public function setDouble($double)
+ {
+ if (is_null($double)) {
+ throw new \InvalidArgumentException('non-nullable double cannot be null');
+ }
+
+ if (($double > 50.2)) {
+ throw new \InvalidArgumentException('invalid value for $double when calling NumberPropertiesOnly., must be smaller than or equal to 50.2.');
+ }
+ if (($double < 0.8)) {
+ throw new \InvalidArgumentException('invalid value for $double when calling NumberPropertiesOnly., must be bigger than or equal to 0.8.');
+ }
+
+ $this->container['double'] = $double;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/samples/client/echo_api/php-nextgen/src/Model/Pet.php b/samples/client/echo_api/php-nextgen/src/Model/Pet.php
new file mode 100644
index 00000000000..86f15d85123
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/src/Model/Pet.php
@@ -0,0 +1,622 @@
+
+ */
+class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'Pet';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'id' => 'int',
+ 'name' => 'string',
+ 'category' => '\OpenAPI\Client\Model\Category',
+ 'photo_urls' => 'string[]',
+ 'tags' => '\OpenAPI\Client\Model\Tag[]',
+ 'status' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'id' => 'int64',
+ 'name' => null,
+ 'category' => null,
+ 'photo_urls' => null,
+ 'tags' => null,
+ 'status' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'id' => false,
+ 'name' => false,
+ 'category' => false,
+ 'photo_urls' => false,
+ 'tags' => false,
+ 'status' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'id' => 'id',
+ 'name' => 'name',
+ 'category' => 'category',
+ 'photo_urls' => 'photoUrls',
+ 'tags' => 'tags',
+ 'status' => 'status'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'id' => 'setId',
+ 'name' => 'setName',
+ 'category' => 'setCategory',
+ 'photo_urls' => 'setPhotoUrls',
+ 'tags' => 'setTags',
+ 'status' => 'setStatus'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'id' => 'getId',
+ 'name' => 'getName',
+ 'category' => 'getCategory',
+ 'photo_urls' => 'getPhotoUrls',
+ 'tags' => 'getTags',
+ 'status' => 'getStatus'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+ public const STATUS_AVAILABLE = 'available';
+ public const STATUS_PENDING = 'pending';
+ public const STATUS_SOLD = 'sold';
+
+ /**
+ * Gets allowable values of the enum
+ *
+ * @return string[]
+ */
+ public function getStatusAllowableValues()
+ {
+ return [
+ self::STATUS_AVAILABLE,
+ self::STATUS_PENDING,
+ self::STATUS_SOLD,
+ ];
+ }
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('id', $data ?? [], null);
+ $this->setIfExists('name', $data ?? [], null);
+ $this->setIfExists('category', $data ?? [], null);
+ $this->setIfExists('photo_urls', $data ?? [], null);
+ $this->setIfExists('tags', $data ?? [], null);
+ $this->setIfExists('status', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ if ($this->container['name'] === null) {
+ $invalidProperties[] = "'name' can't be null";
+ }
+ if ($this->container['photo_urls'] === null) {
+ $invalidProperties[] = "'photo_urls' can't be null";
+ }
+ $allowedValues = $this->getStatusAllowableValues();
+ if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {
+ $invalidProperties[] = sprintf(
+ "invalid value '%s' for 'status', must be one of '%s'",
+ $this->container['status'],
+ implode("', '", $allowedValues)
+ );
+ }
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets id
+ *
+ * @return int|null
+ */
+ public function getId()
+ {
+ return $this->container['id'];
+ }
+
+ /**
+ * Sets id
+ *
+ * @param int|null $id id
+ *
+ * @return self
+ */
+ public function setId($id)
+ {
+ if (is_null($id)) {
+ throw new \InvalidArgumentException('non-nullable id cannot be null');
+ }
+ $this->container['id'] = $id;
+
+ return $this;
+ }
+
+ /**
+ * Gets name
+ *
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->container['name'];
+ }
+
+ /**
+ * Sets name
+ *
+ * @param string $name name
+ *
+ * @return self
+ */
+ public function setName($name)
+ {
+ if (is_null($name)) {
+ throw new \InvalidArgumentException('non-nullable name cannot be null');
+ }
+ $this->container['name'] = $name;
+
+ return $this;
+ }
+
+ /**
+ * Gets category
+ *
+ * @return \OpenAPI\Client\Model\Category|null
+ */
+ public function getCategory()
+ {
+ return $this->container['category'];
+ }
+
+ /**
+ * Sets category
+ *
+ * @param \OpenAPI\Client\Model\Category|null $category category
+ *
+ * @return self
+ */
+ public function setCategory($category)
+ {
+ if (is_null($category)) {
+ throw new \InvalidArgumentException('non-nullable category cannot be null');
+ }
+ $this->container['category'] = $category;
+
+ return $this;
+ }
+
+ /**
+ * Gets photo_urls
+ *
+ * @return string[]
+ */
+ public function getPhotoUrls()
+ {
+ return $this->container['photo_urls'];
+ }
+
+ /**
+ * Sets photo_urls
+ *
+ * @param string[] $photo_urls photo_urls
+ *
+ * @return self
+ */
+ public function setPhotoUrls($photo_urls)
+ {
+ if (is_null($photo_urls)) {
+ throw new \InvalidArgumentException('non-nullable photo_urls cannot be null');
+ }
+ $this->container['photo_urls'] = $photo_urls;
+
+ return $this;
+ }
+
+ /**
+ * Gets tags
+ *
+ * @return \OpenAPI\Client\Model\Tag[]|null
+ */
+ public function getTags()
+ {
+ return $this->container['tags'];
+ }
+
+ /**
+ * Sets tags
+ *
+ * @param \OpenAPI\Client\Model\Tag[]|null $tags tags
+ *
+ * @return self
+ */
+ public function setTags($tags)
+ {
+ if (is_null($tags)) {
+ throw new \InvalidArgumentException('non-nullable tags cannot be null');
+ }
+ $this->container['tags'] = $tags;
+
+ return $this;
+ }
+
+ /**
+ * Gets status
+ *
+ * @return string|null
+ */
+ public function getStatus()
+ {
+ return $this->container['status'];
+ }
+
+ /**
+ * Sets status
+ *
+ * @param string|null $status pet status in the store
+ *
+ * @return self
+ */
+ public function setStatus($status)
+ {
+ if (is_null($status)) {
+ throw new \InvalidArgumentException('non-nullable status cannot be null');
+ }
+ $allowedValues = $this->getStatusAllowableValues();
+ if (!in_array($status, $allowedValues, true)) {
+ throw new \InvalidArgumentException(
+ sprintf(
+ "Invalid value '%s' for 'status', must be one of '%s'",
+ $status,
+ implode("', '", $allowedValues)
+ )
+ );
+ }
+ $this->container['status'] = $status;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/samples/client/echo_api/php-nextgen/src/Model/Query.php b/samples/client/echo_api/php-nextgen/src/Model/Query.php
new file mode 100644
index 00000000000..120083e272a
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/src/Model/Query.php
@@ -0,0 +1,470 @@
+
+ */
+class Query implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'Query';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'id' => 'int',
+ 'outcomes' => 'string[]'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'id' => 'int64',
+ 'outcomes' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'id' => false,
+ 'outcomes' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'id' => 'id',
+ 'outcomes' => 'outcomes'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'id' => 'setId',
+ 'outcomes' => 'setOutcomes'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'id' => 'getId',
+ 'outcomes' => 'getOutcomes'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+ public const OUTCOMES_SUCCESS = 'SUCCESS';
+ public const OUTCOMES_FAILURE = 'FAILURE';
+ public const OUTCOMES_SKIPPED = 'SKIPPED';
+
+ /**
+ * Gets allowable values of the enum
+ *
+ * @return string[]
+ */
+ public function getOutcomesAllowableValues()
+ {
+ return [
+ self::OUTCOMES_SUCCESS,
+ self::OUTCOMES_FAILURE,
+ self::OUTCOMES_SKIPPED,
+ ];
+ }
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('id', $data ?? [], null);
+ $this->setIfExists('outcomes', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets id
+ *
+ * @return int|null
+ */
+ public function getId()
+ {
+ return $this->container['id'];
+ }
+
+ /**
+ * Sets id
+ *
+ * @param int|null $id Query
+ *
+ * @return self
+ */
+ public function setId($id)
+ {
+ if (is_null($id)) {
+ throw new \InvalidArgumentException('non-nullable id cannot be null');
+ }
+ $this->container['id'] = $id;
+
+ return $this;
+ }
+
+ /**
+ * Gets outcomes
+ *
+ * @return string[]|null
+ */
+ public function getOutcomes()
+ {
+ return $this->container['outcomes'];
+ }
+
+ /**
+ * Sets outcomes
+ *
+ * @param string[]|null $outcomes outcomes
+ *
+ * @return self
+ */
+ public function setOutcomes($outcomes)
+ {
+ if (is_null($outcomes)) {
+ throw new \InvalidArgumentException('non-nullable outcomes cannot be null');
+ }
+ $allowedValues = $this->getOutcomesAllowableValues();
+ if (array_diff($outcomes, $allowedValues)) {
+ throw new \InvalidArgumentException(
+ sprintf(
+ "Invalid value for 'outcomes', must be one of '%s'",
+ implode("', '", $allowedValues)
+ )
+ );
+ }
+ $this->container['outcomes'] = $outcomes;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/samples/client/echo_api/php-nextgen/src/Model/StringEnumRef.php b/samples/client/echo_api/php-nextgen/src/Model/StringEnumRef.php
new file mode 100644
index 00000000000..7f2ccd378ff
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/src/Model/StringEnumRef.php
@@ -0,0 +1,51 @@
+
+ */
+class Tag implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'Tag';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'id' => 'int',
+ 'name' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'id' => 'int64',
+ 'name' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'id' => false,
+ 'name' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'id' => 'id',
+ 'name' => 'name'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'id' => 'setId',
+ 'name' => 'setName'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'id' => 'getId',
+ 'name' => 'getName'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('id', $data ?? [], null);
+ $this->setIfExists('name', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets id
+ *
+ * @return int|null
+ */
+ public function getId()
+ {
+ return $this->container['id'];
+ }
+
+ /**
+ * Sets id
+ *
+ * @param int|null $id id
+ *
+ * @return self
+ */
+ public function setId($id)
+ {
+ if (is_null($id)) {
+ throw new \InvalidArgumentException('non-nullable id cannot be null');
+ }
+ $this->container['id'] = $id;
+
+ return $this;
+ }
+
+ /**
+ * Gets name
+ *
+ * @return string|null
+ */
+ public function getName()
+ {
+ return $this->container['name'];
+ }
+
+ /**
+ * Sets name
+ *
+ * @param string|null $name name
+ *
+ * @return self
+ */
+ public function setName($name)
+ {
+ if (is_null($name)) {
+ throw new \InvalidArgumentException('non-nullable name cannot be null');
+ }
+ $this->container['name'] = $name;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/samples/client/echo_api/php-nextgen/src/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.php b/samples/client/echo_api/php-nextgen/src/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.php
new file mode 100644
index 00000000000..8a3f95fe219
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/src/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.php
@@ -0,0 +1,512 @@
+
+ */
+class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'test_query_style_deepObject_explode_true_object_allOf_query_object_parameter';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'size' => 'string',
+ 'color' => 'string',
+ 'id' => 'int',
+ 'name' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'size' => null,
+ 'color' => null,
+ 'id' => 'int64',
+ 'name' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'size' => false,
+ 'color' => false,
+ 'id' => false,
+ 'name' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'size' => 'size',
+ 'color' => 'color',
+ 'id' => 'id',
+ 'name' => 'name'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'size' => 'setSize',
+ 'color' => 'setColor',
+ 'id' => 'setId',
+ 'name' => 'setName'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'size' => 'getSize',
+ 'color' => 'getColor',
+ 'id' => 'getId',
+ 'name' => 'getName'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('size', $data ?? [], null);
+ $this->setIfExists('color', $data ?? [], null);
+ $this->setIfExists('id', $data ?? [], null);
+ $this->setIfExists('name', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets size
+ *
+ * @return string|null
+ */
+ public function getSize()
+ {
+ return $this->container['size'];
+ }
+
+ /**
+ * Sets size
+ *
+ * @param string|null $size size
+ *
+ * @return self
+ */
+ public function setSize($size)
+ {
+ if (is_null($size)) {
+ throw new \InvalidArgumentException('non-nullable size cannot be null');
+ }
+ $this->container['size'] = $size;
+
+ return $this;
+ }
+
+ /**
+ * Gets color
+ *
+ * @return string|null
+ */
+ public function getColor()
+ {
+ return $this->container['color'];
+ }
+
+ /**
+ * Sets color
+ *
+ * @param string|null $color color
+ *
+ * @return self
+ */
+ public function setColor($color)
+ {
+ if (is_null($color)) {
+ throw new \InvalidArgumentException('non-nullable color cannot be null');
+ }
+ $this->container['color'] = $color;
+
+ return $this;
+ }
+
+ /**
+ * Gets id
+ *
+ * @return int|null
+ */
+ public function getId()
+ {
+ return $this->container['id'];
+ }
+
+ /**
+ * Sets id
+ *
+ * @param int|null $id id
+ *
+ * @return self
+ */
+ public function setId($id)
+ {
+ if (is_null($id)) {
+ throw new \InvalidArgumentException('non-nullable id cannot be null');
+ }
+ $this->container['id'] = $id;
+
+ return $this;
+ }
+
+ /**
+ * Gets name
+ *
+ * @return string|null
+ */
+ public function getName()
+ {
+ return $this->container['name'];
+ }
+
+ /**
+ * Sets name
+ *
+ * @param string|null $name name
+ *
+ * @return self
+ */
+ public function setName($name)
+ {
+ if (is_null($name)) {
+ throw new \InvalidArgumentException('non-nullable name cannot be null');
+ }
+ $this->container['name'] = $name;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/samples/client/echo_api/php-nextgen/src/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.php b/samples/client/echo_api/php-nextgen/src/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.php
new file mode 100644
index 00000000000..c1fc04a39c4
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/src/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.php
@@ -0,0 +1,410 @@
+
+ */
+class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'test_query_style_form_explode_true_array_string_query_object_parameter';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'values' => 'string[]'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'values' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'values' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'values' => 'values'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'values' => 'setValues'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'values' => 'getValues'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('values', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets values
+ *
+ * @return string[]|null
+ */
+ public function getValues()
+ {
+ return $this->container['values'];
+ }
+
+ /**
+ * Sets values
+ *
+ * @param string[]|null $values values
+ *
+ * @return self
+ */
+ public function setValues($values)
+ {
+ if (is_null($values)) {
+ throw new \InvalidArgumentException('non-nullable values cannot be null');
+ }
+ $this->container['values'] = $values;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/samples/client/echo_api/php-nextgen/src/ObjectSerializer.php b/samples/client/echo_api/php-nextgen/src/ObjectSerializer.php
new file mode 100644
index 00000000000..780354b3bb5
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/src/ObjectSerializer.php
@@ -0,0 +1,567 @@
+format('Y-m-d') : $data->format(self::$dateTimeFormat);
+ }
+
+ if (is_array($data)) {
+ foreach ($data as $property => $value) {
+ $data[$property] = self::sanitizeForSerialization($value);
+ }
+ return $data;
+ }
+
+ if (is_object($data)) {
+ $values = [];
+ if ($data instanceof ModelInterface) {
+ $formats = $data::openAPIFormats();
+ foreach ($data::openAPITypes() as $property => $openAPIType) {
+ $getter = $data::getters()[$property];
+ $value = $data->$getter();
+ if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) {
+ if (is_sublass_of($openAPIType, '\BackedEnum')) {
+ $data = $openAPIType::tryFrom($data);
+ if ($data === null) {
+ $imploded = implode("', '", array_map(fn($case) => $case->value, $openAPIType::cases()));
+ throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'");
+ }
+ }
+ }
+ if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) {
+ $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]);
+ }
+ }
+ } else {
+ foreach($data as $property => $value) {
+ $values[$property] = self::sanitizeForSerialization($value);
+ }
+ }
+ return (object)$values;
+ } else {
+ return (string)$data;
+ }
+ }
+
+ /**
+ * Sanitize filename by removing path.
+ * e.g. ../../sun.gif becomes sun.gif
+ *
+ * @param string $filename filename to be sanitized
+ *
+ * @return string the sanitized filename
+ */
+ public static function sanitizeFilename($filename)
+ {
+ if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) {
+ return $match[1];
+ } else {
+ return $filename;
+ }
+ }
+
+ /**
+ * Shorter timestamp microseconds to 6 digits length.
+ *
+ * @param string $timestamp Original timestamp
+ *
+ * @return string the shorten timestamp
+ */
+ public static function sanitizeTimestamp($timestamp)
+ {
+ if (!is_string($timestamp)) return $timestamp;
+
+ return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp);
+ }
+
+ /**
+ * Take value and turn it into a string suitable for inclusion in
+ * the path, by url-encoding.
+ *
+ * @param string $value a string which will be part of the path
+ *
+ * @return string the serialized object
+ */
+ public static function toPathValue($value)
+ {
+ return rawurlencode(self::toString($value));
+ }
+
+ /**
+ * Checks if a value is empty, based on its OpenAPI type.
+ *
+ * @param mixed $value
+ * @param string $openApiType
+ *
+ * @return bool true if $value is empty
+ */
+ private static function isEmptyValue($value, string $openApiType): bool
+ {
+ # If empty() returns false, it is not empty regardless of its type.
+ if (!empty($value)) {
+ return false;
+ }
+
+ # Null is always empty, as we cannot send a real "null" value in a query parameter.
+ if ($value === null) {
+ return true;
+ }
+
+ switch ($openApiType) {
+ # For numeric values, false and '' are considered empty.
+ # This comparison is safe for floating point values, since the previous call to empty() will
+ # filter out values that don't match 0.
+ case 'int':
+ case 'integer':
+ return $value !== 0;
+
+ case 'number':
+ case 'float':
+ return $value !== 0 && $value !== 0.0;
+
+ # For boolean values, '' is considered empty
+ case 'bool':
+ case 'boolean':
+ return !in_array($value, [false, 0], true);
+
+ # For all the other types, any value at this point can be considered empty.
+ default:
+ return true;
+ }
+ }
+
+ /**
+ * Take query parameter properties and turn it into an array suitable for
+ * native http_build_query or GuzzleHttp\Psr7\Query::build.
+ *
+ * @param mixed $value Parameter value
+ * @param string $paramName Parameter name
+ * @param string $openApiType OpenAPIType eg. array or object
+ * @param string $style Parameter serialization style
+ * @param bool $explode Parameter explode option
+ * @param bool $required Whether query param is required or not
+ *
+ * @return array
+ */
+ public static function toQueryValue(
+ $value,
+ string $paramName,
+ string $openApiType = 'string',
+ string $style = 'form',
+ bool $explode = true,
+ bool $required = true
+ ): array {
+
+ # Check if we should omit this parameter from the query. This should only happen when:
+ # - Parameter is NOT required; AND
+ # - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For
+ # example, 0 as "int" or "boolean" is NOT an empty value.
+ if (self::isEmptyValue($value, $openApiType)) {
+ if ($required) {
+ return ["{$paramName}" => ''];
+ } else {
+ return [];
+ }
+ }
+
+ # Handle DateTime objects in query
+ if($openApiType === "\\DateTime" && $value instanceof \DateTime) {
+ return ["{$paramName}" => $value->format(self::$dateTimeFormat)];
+ }
+
+ $query = [];
+ $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value;
+
+ // since \GuzzleHttp\Psr7\Query::build fails with nested arrays
+ // need to flatten array first
+ $flattenArray = function ($arr, $name, &$result = []) use (&$flattenArray, $style, $explode) {
+ if (!is_array($arr)) return $arr;
+
+ foreach ($arr as $k => $v) {
+ $prop = ($style === 'deepObject') ? $prop = "{$name}[{$k}]" : $k;
+
+ if (is_array($v)) {
+ $flattenArray($v, $prop, $result);
+ } else {
+ if ($style !== 'deepObject' && !$explode) {
+ // push key itself
+ $result[] = $prop;
+ }
+ $result[$prop] = $v;
+ }
+ }
+ return $result;
+ };
+
+ $value = $flattenArray($value, $paramName);
+
+ if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) {
+ return $value;
+ }
+
+ if ('boolean' === $openApiType && is_bool($value)) {
+ $value = self::convertBoolToQueryStringFormat($value);
+ }
+
+ // handle style in serializeCollection
+ $query[$paramName] = ($explode) ? $value : self::serializeCollection((array)$value, $style);
+
+ return $query;
+ }
+
+ /**
+ * Convert boolean value to format for query string.
+ *
+ * @param bool $value Boolean value
+ *
+ * @return int|string Boolean value in format
+ */
+ public static function convertBoolToQueryStringFormat(bool $value)
+ {
+ if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) {
+ return $value ? 'true' : 'false';
+ }
+
+ return (int) $value;
+ }
+
+ /**
+ * Take value and turn it into a string suitable for inclusion in
+ * the header. If it's a string, pass through unchanged
+ * If it's a datetime object, format it in ISO8601
+ *
+ * @param string $value a string which will be part of the header
+ *
+ * @return string the header string
+ */
+ public static function toHeaderValue($value)
+ {
+ $callable = [$value, 'toHeaderValue'];
+ if (is_callable($callable)) {
+ return $callable();
+ }
+
+ return self::toString($value);
+ }
+
+ /**
+ * Take value and turn it into a string suitable for inclusion in
+ * the http body (form parameter). If it's a string, pass through unchanged
+ * If it's a datetime object, format it in ISO8601
+ *
+ * @param string|\SplFileObject $value the value of the form parameter
+ *
+ * @return string the form string
+ */
+ public static function toFormValue($value)
+ {
+ if ($value instanceof \SplFileObject) {
+ return $value->getRealPath();
+ } else {
+ return self::toString($value);
+ }
+ }
+
+ /**
+ * Take value and turn it into a string suitable for inclusion in
+ * the parameter. If it's a string, pass through unchanged
+ * If it's a datetime object, format it in ISO8601
+ * If it's a boolean, convert it to "true" or "false".
+ *
+ * @param string|bool|\DateTime $value the value of the parameter
+ *
+ * @return string the header string
+ */
+ public static function toString($value)
+ {
+ if ($value instanceof \DateTime) { // datetime in ISO8601 format
+ return $value->format(self::$dateTimeFormat);
+ } elseif (is_bool($value)) {
+ return $value ? 'true' : 'false';
+ } else {
+ return (string) $value;
+ }
+ }
+
+ /**
+ * Serialize an array to a string.
+ *
+ * @param array $collection collection to serialize to a string
+ * @param string $style the format use for serialization (csv,
+ * ssv, tsv, pipes, multi)
+ * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array
+ *
+ * @return string
+ */
+ public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false)
+ {
+ if ($allowCollectionFormatMulti && ('multi' === $style)) {
+ // http_build_query() almost does the job for us. We just
+ // need to fix the result of multidimensional arrays.
+ return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&'));
+ }
+ switch ($style) {
+ case 'pipeDelimited':
+ case 'pipes':
+ return implode('|', $collection);
+
+ case 'tsv':
+ return implode("\t", $collection);
+
+ case 'spaceDelimited':
+ case 'ssv':
+ return implode(' ', $collection);
+
+ case 'simple':
+ case 'csv':
+ // Deliberate fall through. CSV is default format.
+ default:
+ return implode(',', $collection);
+ }
+ }
+
+ /**
+ * Deserialize a JSON string into an object
+ *
+ * @param mixed $data object or primitive to be deserialized
+ * @param string $class class name is passed as a string
+ * @param string[] $httpHeaders HTTP headers
+ * @param string $discriminator discriminator if polymorphism is used
+ *
+ * @return object|array|null a single or an array of $class instances
+ */
+ public static function deserialize($data, $class, $httpHeaders = null)
+ {
+ if (null === $data) {
+ return null;
+ }
+
+ if (strcasecmp(substr($class, -2), '[]') === 0) {
+ $data = is_string($data) ? json_decode($data) : $data;
+
+ if (!is_array($data)) {
+ throw new \InvalidArgumentException("Invalid array '$class'");
+ }
+
+ $subClass = substr($class, 0, -2);
+ $values = [];
+ foreach ($data as $key => $value) {
+ $values[] = self::deserialize($value, $subClass, null);
+ }
+ return $values;
+ }
+
+ if (preg_match('/^(array<|map\[)/', $class)) { // for associative array e.g. array
+ $data = is_string($data) ? json_decode($data) : $data;
+ settype($data, 'array');
+ $inner = substr($class, 4, -1);
+ $deserialized = [];
+ if (strrpos($inner, ",") !== false) {
+ $subClass_array = explode(',', $inner, 2);
+ $subClass = $subClass_array[1];
+ foreach ($data as $key => $value) {
+ $deserialized[$key] = self::deserialize($value, $subClass, null);
+ }
+ }
+ return $deserialized;
+ }
+
+ if ($class === 'object') {
+ settype($data, 'array');
+ return $data;
+ } elseif ($class === 'mixed') {
+ settype($data, gettype($data));
+ return $data;
+ }
+
+ if ($class === '\DateTime') {
+ // Some APIs return an invalid, empty string as a
+ // date-time property. DateTime::__construct() will return
+ // the current time for empty input which is probably not
+ // what is meant. The invalid empty string is probably to
+ // be interpreted as a missing field/value. Let's handle
+ // this graceful.
+ if (!empty($data)) {
+ try {
+ return new \DateTime($data);
+ } catch (\Exception $exception) {
+ // Some APIs return a date-time with too high nanosecond
+ // precision for php's DateTime to handle.
+ // With provided regexp 6 digits of microseconds saved
+ return new \DateTime(self::sanitizeTimestamp($data));
+ }
+ } else {
+ return null;
+ }
+ }
+
+ if ($class === '\SplFileObject') {
+ $data = Utils::streamFor($data);
+
+ /** @var \Psr\Http\Message\StreamInterface $data */
+
+ // determine file name
+ if (
+ is_array($httpHeaders)
+ && array_key_exists('Content-Disposition', $httpHeaders)
+ && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match)
+ ) {
+ $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]);
+ } else {
+ $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), '');
+ }
+
+ $file = fopen($filename, 'w');
+ while ($chunk = $data->read(200)) {
+ fwrite($file, $chunk);
+ }
+ fclose($file);
+
+ return new \SplFileObject($filename, 'r');
+ }
+
+ /** @psalm-suppress ParadoxicalCondition */
+ if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) {
+ settype($data, $class);
+ return $data;
+ }
+
+
+ if (is_subclass_of($class, '\BackedEnum')) {
+ $data = $class::tryFrom($data);
+ if ($data === null) {
+ $imploded = implode("', '", array_map(fn($case) => $case->value, $class::cases()));
+ throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'");
+ }
+ return $data;
+ } else {
+ $data = is_string($data) ? json_decode($data) : $data;
+
+ if (is_array($data)) {
+ $data = (object)$data;
+ }
+
+ // If a discriminator is defined and points to a valid subclass, use it.
+ $discriminator = $class::DISCRIMINATOR;
+ if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) {
+ $subclass = '\OpenAPI\Client\Model\\' . $data->{$discriminator};
+ if (is_subclass_of($subclass, $class)) {
+ $class = $subclass;
+ }
+ }
+
+ /** @var ModelInterface $instance */
+ $instance = new $class();
+ foreach ($instance::openAPITypes() as $property => $type) {
+ $propertySetter = $instance::setters()[$property];
+
+ if (!isset($propertySetter)) {
+ continue;
+ }
+
+ if (!isset($data->{$instance::attributeMap()[$property]})) {
+ if ($instance::isNullable($property)) {
+ $instance->$propertySetter(null);
+ }
+
+ continue;
+ }
+
+ if (isset($data->{$instance::attributeMap()[$property]})) {
+ $propertyValue = $data->{$instance::attributeMap()[$property]};
+ $instance->$propertySetter(self::deserialize($propertyValue, $type, null));
+ }
+ }
+ return $instance;
+ }
+ }
+
+ /**
+ * Native `http_build_query` wrapper.
+ * @see https://www.php.net/manual/en/function.http-build-query
+ *
+ * @param array|object $data May be an array or object containing properties.
+ * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only.
+ * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter.
+ * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738.
+ *
+ * @return string
+ */
+ public static function buildQuery(
+ $data,
+ string $numeric_prefix = '',
+ ?string $arg_separator = null,
+ int $encoding_type = \PHP_QUERY_RFC3986
+ ): string {
+ return \GuzzleHttp\Psr7\Query::build($data, $encoding_type);
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen/tests/Api/AuthApiTest.php b/samples/client/echo_api/php-nextgen/tests/Api/AuthApiTest.php
new file mode 100644
index 00000000000..fee328d51e5
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/tests/Api/AuthApiTest.php
@@ -0,0 +1,86 @@
+markTestIncomplete('Not implemented');
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen/tests/Api/BodyApiTest.php b/samples/client/echo_api/php-nextgen/tests/Api/BodyApiTest.php
new file mode 100644
index 00000000000..24b4ef0f394
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/tests/Api/BodyApiTest.php
@@ -0,0 +1,158 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test case for testBodyApplicationOctetstreamBinary
+ *
+ * Test body parameter(s).
+ *
+ */
+ public function testTestBodyApplicationOctetstreamBinary()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test case for testBodyMultipartFormdataArrayOfBinary
+ *
+ * Test array of binary in multipart mime.
+ *
+ */
+ public function testTestBodyMultipartFormdataArrayOfBinary()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test case for testEchoBodyFreeFormObjectResponseString
+ *
+ * Test free form object.
+ *
+ */
+ public function testTestEchoBodyFreeFormObjectResponseString()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test case for testEchoBodyPet
+ *
+ * Test body parameter(s).
+ *
+ */
+ public function testTestEchoBodyPet()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test case for testEchoBodyPetResponseString
+ *
+ * Test empty response body.
+ *
+ */
+ public function testTestEchoBodyPetResponseString()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test case for testEchoBodyTagResponseString
+ *
+ * Test empty json (request body).
+ *
+ */
+ public function testTestEchoBodyTagResponseString()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen/tests/Api/FormApiTest.php b/samples/client/echo_api/php-nextgen/tests/Api/FormApiTest.php
new file mode 100644
index 00000000000..daa305ab02f
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/tests/Api/FormApiTest.php
@@ -0,0 +1,98 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test case for testFormOneof
+ *
+ * Test form parameter(s) for oneOf schema.
+ *
+ */
+ public function testTestFormOneof()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen/tests/Api/HeaderApiTest.php b/samples/client/echo_api/php-nextgen/tests/Api/HeaderApiTest.php
new file mode 100644
index 00000000000..21e1c88b7b0
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/tests/Api/HeaderApiTest.php
@@ -0,0 +1,86 @@
+markTestIncomplete('Not implemented');
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen/tests/Api/PathApiTest.php b/samples/client/echo_api/php-nextgen/tests/Api/PathApiTest.php
new file mode 100644
index 00000000000..d01f470f01f
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/tests/Api/PathApiTest.php
@@ -0,0 +1,86 @@
+markTestIncomplete('Not implemented');
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen/tests/Api/QueryApiTest.php b/samples/client/echo_api/php-nextgen/tests/Api/QueryApiTest.php
new file mode 100644
index 00000000000..b066dfc199d
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/tests/Api/QueryApiTest.php
@@ -0,0 +1,170 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test case for testQueryDatetimeDateString
+ *
+ * Test query parameter(s).
+ *
+ */
+ public function testTestQueryDatetimeDateString()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test case for testQueryIntegerBooleanString
+ *
+ * Test query parameter(s).
+ *
+ */
+ public function testTestQueryIntegerBooleanString()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test case for testQueryStyleDeepObjectExplodeTrueObject
+ *
+ * Test query parameter(s).
+ *
+ */
+ public function testTestQueryStyleDeepObjectExplodeTrueObject()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test case for testQueryStyleDeepObjectExplodeTrueObjectAllOf
+ *
+ * Test query parameter(s).
+ *
+ */
+ public function testTestQueryStyleDeepObjectExplodeTrueObjectAllOf()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test case for testQueryStyleFormExplodeTrueArrayString
+ *
+ * Test query parameter(s).
+ *
+ */
+ public function testTestQueryStyleFormExplodeTrueArrayString()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test case for testQueryStyleFormExplodeTrueObject
+ *
+ * Test query parameter(s).
+ *
+ */
+ public function testTestQueryStyleFormExplodeTrueObject()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test case for testQueryStyleFormExplodeTrueObjectAllOf
+ *
+ * Test query parameter(s).
+ *
+ */
+ public function testTestQueryStyleFormExplodeTrueObjectAllOf()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen/tests/Model/BirdTest.php b/samples/client/echo_api/php-nextgen/tests/Model/BirdTest.php
new file mode 100644
index 00000000000..ef424f438ad
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/tests/Model/BirdTest.php
@@ -0,0 +1,100 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "size"
+ */
+ public function testPropertySize()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "color"
+ */
+ public function testPropertyColor()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen/tests/Model/CategoryTest.php b/samples/client/echo_api/php-nextgen/tests/Model/CategoryTest.php
new file mode 100644
index 00000000000..c643cb2b36c
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/tests/Model/CategoryTest.php
@@ -0,0 +1,100 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "id"
+ */
+ public function testPropertyId()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "name"
+ */
+ public function testPropertyName()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen/tests/Model/DataQueryTest.php b/samples/client/echo_api/php-nextgen/tests/Model/DataQueryTest.php
new file mode 100644
index 00000000000..43cdd5c7a90
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/tests/Model/DataQueryTest.php
@@ -0,0 +1,109 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "suffix"
+ */
+ public function testPropertySuffix()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "text"
+ */
+ public function testPropertyText()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "date"
+ */
+ public function testPropertyDate()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen/tests/Model/DefaultValueTest.php b/samples/client/echo_api/php-nextgen/tests/Model/DefaultValueTest.php
new file mode 100644
index 00000000000..5d1bb167649
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/tests/Model/DefaultValueTest.php
@@ -0,0 +1,154 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "array_string_enum_ref_default"
+ */
+ public function testPropertyArrayStringEnumRefDefault()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "array_string_enum_default"
+ */
+ public function testPropertyArrayStringEnumDefault()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "array_string_default"
+ */
+ public function testPropertyArrayStringDefault()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "array_integer_default"
+ */
+ public function testPropertyArrayIntegerDefault()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "array_string"
+ */
+ public function testPropertyArrayString()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "array_string_nullable"
+ */
+ public function testPropertyArrayStringNullable()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "array_string_extension_nullable"
+ */
+ public function testPropertyArrayStringExtensionNullable()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "string_nullable"
+ */
+ public function testPropertyStringNullable()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen/tests/Model/NumberPropertiesOnlyTest.php b/samples/client/echo_api/php-nextgen/tests/Model/NumberPropertiesOnlyTest.php
new file mode 100644
index 00000000000..f1de2cd6cfd
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/tests/Model/NumberPropertiesOnlyTest.php
@@ -0,0 +1,109 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "number"
+ */
+ public function testPropertyNumber()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "float"
+ */
+ public function testPropertyFloat()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "double"
+ */
+ public function testPropertyDouble()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen/tests/Model/PetTest.php b/samples/client/echo_api/php-nextgen/tests/Model/PetTest.php
new file mode 100644
index 00000000000..1b11ec08fdc
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/tests/Model/PetTest.php
@@ -0,0 +1,136 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "id"
+ */
+ public function testPropertyId()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "name"
+ */
+ public function testPropertyName()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "category"
+ */
+ public function testPropertyCategory()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "photo_urls"
+ */
+ public function testPropertyPhotoUrls()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "tags"
+ */
+ public function testPropertyTags()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "status"
+ */
+ public function testPropertyStatus()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen/tests/Model/QueryTest.php b/samples/client/echo_api/php-nextgen/tests/Model/QueryTest.php
new file mode 100644
index 00000000000..e984a7919ff
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/tests/Model/QueryTest.php
@@ -0,0 +1,100 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "id"
+ */
+ public function testPropertyId()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "outcomes"
+ */
+ public function testPropertyOutcomes()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen/tests/Model/StringEnumRefTest.php b/samples/client/echo_api/php-nextgen/tests/Model/StringEnumRefTest.php
new file mode 100644
index 00000000000..f48e712c2dd
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/tests/Model/StringEnumRefTest.php
@@ -0,0 +1,82 @@
+markTestIncomplete('Not implemented');
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen/tests/Model/TagTest.php b/samples/client/echo_api/php-nextgen/tests/Model/TagTest.php
new file mode 100644
index 00000000000..2f1c1315bb6
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/tests/Model/TagTest.php
@@ -0,0 +1,100 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "id"
+ */
+ public function testPropertyId()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "name"
+ */
+ public function testPropertyName()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen/tests/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterTest.php b/samples/client/echo_api/php-nextgen/tests/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterTest.php
new file mode 100644
index 00000000000..08e837c50b6
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/tests/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterTest.php
@@ -0,0 +1,118 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "size"
+ */
+ public function testPropertySize()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "color"
+ */
+ public function testPropertyColor()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "id"
+ */
+ public function testPropertyId()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "name"
+ */
+ public function testPropertyName()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/samples/client/echo_api/php-nextgen/tests/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTest.php b/samples/client/echo_api/php-nextgen/tests/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTest.php
new file mode 100644
index 00000000000..81783415f44
--- /dev/null
+++ b/samples/client/echo_api/php-nextgen/tests/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTest.php
@@ -0,0 +1,91 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "values"
+ */
+ public function testPropertyValues()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}