forked from loafle/openapi-generator-original
[php] replace $collectionFormat with $style (#5517)
* php - remove $collectionFormat * update php openapi3 petstore sample
This commit is contained in:
@@ -2677,7 +2677,7 @@ class FakeApi
|
||||
|
||||
// query params
|
||||
if (is_array($enum_query_string_array)) {
|
||||
$enum_query_string_array = ObjectSerializer::serializeCollection($enum_query_string_array, 'csv', true);
|
||||
$enum_query_string_array = ObjectSerializer::serializeCollection($enum_query_string_array, 'form', true);
|
||||
}
|
||||
if ($enum_query_string_array !== null) {
|
||||
$queryParams['enum_query_string_array'] = $enum_query_string_array;
|
||||
@@ -3761,7 +3761,7 @@ class FakeApi
|
||||
|
||||
// query params
|
||||
if (is_array($pipe)) {
|
||||
$pipe = ObjectSerializer::serializeCollection($pipe, 'csv', true);
|
||||
$pipe = ObjectSerializer::serializeCollection($pipe, 'form', true);
|
||||
}
|
||||
if ($pipe !== null) {
|
||||
$queryParams['pipe'] = $pipe;
|
||||
@@ -3779,7 +3779,7 @@ class FakeApi
|
||||
|
||||
// query params
|
||||
if (is_array($http)) {
|
||||
$http = ObjectSerializer::serializeCollection($http, 'space', true);
|
||||
$http = ObjectSerializer::serializeCollection($http, 'spaceDelimited', true);
|
||||
}
|
||||
if ($http !== null) {
|
||||
$queryParams['http'] = $http;
|
||||
@@ -3788,7 +3788,7 @@ class FakeApi
|
||||
|
||||
// query params
|
||||
if (is_array($url)) {
|
||||
$url = ObjectSerializer::serializeCollection($url, 'csv', true);
|
||||
$url = ObjectSerializer::serializeCollection($url, 'form', true);
|
||||
}
|
||||
if ($url !== null) {
|
||||
$queryParams['url'] = $url;
|
||||
|
||||
@@ -778,7 +778,7 @@ class PetApi
|
||||
|
||||
// query params
|
||||
if (is_array($status)) {
|
||||
$status = ObjectSerializer::serializeCollection($status, 'csv', true);
|
||||
$status = ObjectSerializer::serializeCollection($status, 'form', true);
|
||||
}
|
||||
if ($status !== null) {
|
||||
$queryParams['status'] = $status;
|
||||
@@ -1056,7 +1056,7 @@ class PetApi
|
||||
|
||||
// query params
|
||||
if (is_array($tags)) {
|
||||
$tags = ObjectSerializer::serializeCollection($tags, 'csv', true);
|
||||
$tags = ObjectSerializer::serializeCollection($tags, 'form', true);
|
||||
}
|
||||
if ($tags !== null) {
|
||||
$queryParams['tags'] = $tags;
|
||||
|
||||
@@ -213,7 +213,7 @@ class ObjectSerializer
|
||||
* Serialize an array to a string.
|
||||
*
|
||||
* @param array $collection collection to serialize to a string
|
||||
* @param string $collectionFormat the format use for serialization (csv,
|
||||
* @param string $style the format use for serialization (csv,
|
||||
* ssv, tsv, pipes, multi)
|
||||
* @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array
|
||||
*
|
||||
@@ -221,7 +221,7 @@ class ObjectSerializer
|
||||
*/
|
||||
public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false)
|
||||
{
|
||||
if ($allowCollectionFormatMulti && ('multi' === $collectionFormat)) {
|
||||
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, '', '&'));
|
||||
|
||||
Reference in New Issue
Block a user