Serialization
Trait Serialization.
Serialization and JSON stuff.
Depends on the following properties:
Table of Contents
Properties
- $daysInMonth : int
- $month : int
- $quarter : int
- $year : int
- $dumpDateProperties : array<string|int, mixed>|null
- Embed date properties to dump in a dedicated variables so it won't overlap native DateTime ones.
- $dumpLocale : string|null
- Locale to dump comes here before serialization.
- $dumpProperties : array<string|int, string>
- List of key to use for dump/serialization.
Methods
- __serialize() : array<string|int, mixed>
- Returns the values to dump on serialize() called on.
- __set_state() : static
- The __set_state handler.
- __sleep() : array<string|int, mixed>
- Returns the list of properties to dump on serialize() called on.
- __unserialize() : void
- Set locale if specified on unserialize() called.
- __wakeup() : void
- Set locale if specified on unserialize() called.
- cleanupDumpProperties() : self
- Cleanup properties attached to the public scope of DateTime when a dump of the date is requested.
- fromSerialized() : static
- Create an instance from a serialized string.
- jsonSerialize() : mixed
- Prepare the object for JSON serialization.
- locale() : string|static
- serialize() : string
- Return a serialized string of the instance.
- serializeUsing() : void
- toJSON() : string
- dumpTimezone() : mixed
- getSleepProperties() : array<string|int, mixed>
Properties
$daysInMonth
public
int
$daysInMonth
$month
public
int
$month
$quarter
public
int
$quarter
Depends on the following methods:
$year
public
int
$year
$dumpDateProperties
Embed date properties to dump in a dedicated variables so it won't overlap native DateTime ones.
protected
array<string|int, mixed>|null
$dumpDateProperties
$dumpLocale
Locale to dump comes here before serialization.
protected
string|null
$dumpLocale
$dumpProperties
List of key to use for dump/serialization.
protected
array<string|int, string>
$dumpProperties
= ['date', 'timezone_type', 'timezone']
Methods
__serialize()
Returns the values to dump on serialize() called on.
public
__serialize() : array<string|int, mixed>
Only used by PHP >= 7.4.
Return values
array<string|int, mixed>__set_state()
The __set_state handler.
public
static __set_state(string|array<string|int, mixed> $dump) : static
Parameters
- $dump : string|array<string|int, mixed>
Return values
static__sleep()
Returns the list of properties to dump on serialize() called on.
public
__sleep() : array<string|int, mixed>
Only used by PHP < 7.4.
Return values
array<string|int, mixed>__unserialize()
Set locale if specified on unserialize() called.
public
__unserialize(array<string|int, mixed> $data) : void
Only used by PHP >= 7.4.
Parameters
- $data : array<string|int, mixed>
__wakeup()
Set locale if specified on unserialize() called.
public
__wakeup() : void
Only used by PHP < 7.4.
cleanupDumpProperties()
Cleanup properties attached to the public scope of DateTime when a dump of the date is requested.
public
cleanupDumpProperties() : self
foreach ($date as $_) } serializer($date) var_export($date) get_object_vars($date)
Return values
selffromSerialized()
Create an instance from a serialized string.
public
static fromSerialized(string $value) : static
Parameters
- $value : string
Tags
Return values
staticjsonSerialize()
Prepare the object for JSON serialization.
public
jsonSerialize() : mixed
locale()
public
locale(string $locale = null, string $fallbackLocales) : string|static
Parameters
- $locale = null : string
- $fallbackLocales : string
Return values
string|staticserialize()
Return a serialized string of the instance.
public
serialize() : string
Return values
stringserializeUsing()
public
static serializeUsing(string|callable|null $format) : void
Parameters
- $format : string|callable|null
Tags
toJSON()
public
toJSON() : string
Return values
stringdumpTimezone()
private
dumpTimezone(mixed $timezone) : mixed
Parameters
- $timezone : mixed
getSleepProperties()
private
getSleepProperties() : array<string|int, mixed>