Pionia Core

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

$quarter

public int $quarter

Depends on the following methods:

$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
self

fromSerialized()

Create an instance from a serialized string.

public static fromSerialized(string $value) : static
Parameters
$value : string
Tags
throws
InvalidFormatException
Return values
static

jsonSerialize()

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|static

serialize()

Return a serialized string of the instance.

public serialize() : string
Return values
string

serializeUsing()

public static serializeUsing(string|callable|null $format) : void
Parameters
$format : string|callable|null
Tags
deprecated

To avoid conflict between different third-party libraries, static setters should not be used. You should rather transform Carbon object before the serialization.

JSON serialize all Carbon instances using the given callback.

dumpTimezone()

private dumpTimezone(mixed $timezone) : mixed
Parameters
$timezone : mixed

getSleepProperties()

private getSleepProperties() : array<string|int, mixed>
Return values
array<string|int, mixed>

        
On this page

Search results