ObjectSerializer
in package
ObjectSerializer Class Doc Comment
Tags
Table of Contents
- $dateTimeFormat : string
- buildQuery() : string
- Native `http_build_query` wrapper.
- 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()
Native `http_build_query` wrapper.
public
static buildQuery(array<string|int, mixed>|object $data[, string $numeric_prefix = '' ][, string|null $arg_separator = null ][, int $encoding_type = PHP_QUERY_RFC3986 ]) : string
Parameters
- $data : array<string|int, mixed>|object
-
May be an array or object containing properties.
- $numeric_prefix : string = ''
-
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.
- $arg_separator : string|null = null
-
arg_separator.output is used to separate arguments but may be overridden by specifying this parameter.
- $encoding_type : int = PHP_QUERY_RFC3986
-
Encoding type. By default, PHP_QUERY_RFC1738.
Tags
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(string|bool|DateTime $value) : string
Parameters
- $value : string|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