ObjectSerializer
in package
ObjectSerializer Class Doc Comment
Tags
Table of Contents
- $dateTimeFormat : string
- buildQuery() : string
- Build a query string from an array of key value pairs.
- convertBoolToQueryStringFormat() : int|string
- Convert boolean value to format for query string.
- deserialize() : object|array<string|int, mixed>|null
- Deserialize a JSON string into an object
- sanitizeFilename() : string
- Sanitize filename by removing path.
- sanitizeForSerialization() : scalar|object|array<string|int, mixed>|null
- Serialize data
- sanitizeTimestamp() : string
- Shorter timestamp microseconds to 6 digits length.
- serializeCollection() : string
- Serialize an array to a string.
- setDateTimeFormat() : mixed
- Change the date format
- toFormValue() : string
- 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
- toHeaderValue() : string
- 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
- toPathValue() : string
- Take value and turn it into a string suitable for inclusion in the path, by url-encoding.
- toQueryValue() : array<string|int, mixed>
- Take query parameter properties and turn it into an array suitable for native http_build_query or GuzzleHttp\Psr7\Query::build.
- toString() : string
- 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".
- isEmptyValue() : bool
- Checks if a value is empty, based on its OpenAPI type.
Properties
$dateTimeFormat
private
static string
$dateTimeFormat
= \DateTime::ATOM
Methods
buildQuery()
Build a query string from an array of key value pairs.
public
static buildQuery(array<string|int, mixed> $params[, int|false $encoding = PHP_QUERY_RFC3986 ]) : string
This function can use the return value of parse()
to build a query
string. This function does not modify the provided keys when an array is
encountered (like http_build_query()
would).
The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 with a modification which is described in https://github.com/guzzle/psr7/pull/603
Parameters
- $params : array<string|int, mixed>
-
Query string parameters.
- $encoding : int|false = PHP_QUERY_RFC3986
-
Set to false to not encode, PHP_QUERY_RFC3986 to encode using RFC3986, or PHP_QUERY_RFC1738 to encode using RFC1738.
Return values
string —convertBoolToQueryStringFormat()
Convert boolean value to format for query string.
public
static convertBoolToQueryStringFormat(bool $value) : int|string
Parameters
- $value : bool
-
Boolean value
Return values
int|string —Boolean value in format
deserialize()
Deserialize a JSON string into an object
public
static deserialize(mixed $data, string $class[, array<string|int, string> $httpHeaders = null ]) : object|array<string|int, mixed>|null
Parameters
- $data : mixed
-
object or primitive to be deserialized
- $class : string
-
class name is passed as a string
- $httpHeaders : array<string|int, string> = null
-
HTTP headers
Return values
object|array<string|int, mixed>|null —a single or an array of $class instances
sanitizeFilename()
Sanitize filename by removing path.
public
static sanitizeFilename(string $filename) : string
e.g. ../../sun.gif becomes sun.gif
Parameters
- $filename : string
-
filename to be sanitized
Return values
string —the sanitized filename
sanitizeForSerialization()
Serialize data
public
static sanitizeForSerialization(mixed $data[, string $type = null ][, string $format = null ]) : scalar|object|array<string|int, mixed>|null
Parameters
- $data : mixed
-
the data to serialize
- $type : string = null
-
the OpenAPIToolsType of the data
- $format : string = null
-
the format of the OpenAPITools type of the data
Return values
scalar|object|array<string|int, mixed>|null —serialized form of $data
sanitizeTimestamp()
Shorter timestamp microseconds to 6 digits length.
public
static sanitizeTimestamp(string $timestamp) : string
Parameters
- $timestamp : string
-
Original timestamp
Return values
string —the shorten timestamp
serializeCollection()
Serialize an array to a string.
public
static serializeCollection(array<string|int, mixed> $collection, string $style[, bool $allowCollectionFormatMulti = false ]) : string
Parameters
- $collection : array<string|int, mixed>
-
collection to serialize to a string
- $style : string
-
the format use for serialization (csv, ssv, tsv, pipes, multi)
- $allowCollectionFormatMulti : bool = false
-
allow collection format to be a multidimensional array
Return values
string —setDateTimeFormat()
Change the date format
public
static setDateTimeFormat(string $format) : mixed
Parameters
- $format : string
-
the new date format to use
Return values
mixed —toFormValue()
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
public
static toFormValue(string|SplFileObject $value) : string
Parameters
- $value : string|SplFileObject
-
the value of the form parameter
Return values
string —the form string
toHeaderValue()
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
public
static toHeaderValue(string $value) : string
Parameters
- $value : string
-
a string which will be part of the header
Return values
string —the header string
toPathValue()
Take value and turn it into a string suitable for inclusion in the path, by url-encoding.
public
static toPathValue(string $value) : string
Parameters
- $value : string
-
a string which will be part of the path
Return values
string —the serialized object
toQueryValue()
Take query parameter properties and turn it into an array suitable for native http_build_query or GuzzleHttp\Psr7\Query::build.
public
static toQueryValue(mixed $value, string $paramName[, string $openApiType = 'string' ][, string $style = 'form' ][, bool $explode = true ][, bool $required = true ]) : array<string|int, mixed>
Parameters
- $value : mixed
-
Parameter value
- $paramName : string
-
Parameter name
- $openApiType : string = 'string'
-
OpenAPIType eg. array or object
- $style : string = 'form'
-
Parameter serialization style
- $explode : bool = true
-
Parameter explode option
- $required : bool = true
-
Whether query param is required or not
Return values
array<string|int, mixed> —toString()
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".
public
static toString(float|int|bool|DateTime $value) : string
Parameters
- $value : float|int|bool|DateTime
-
the value of the parameter
Return values
string —the header string
isEmptyValue()
Checks if a value is empty, based on its OpenAPI type.
private
static isEmptyValue(mixed $value, string $openApiType) : bool
Parameters
- $value : mixed
- $openApiType : string
Return values
bool —true if $value is empty