trait Serialization

Trait Serialization.

Serialization and JSON stuff.

Depends on the following properties:

Traits

Properties

protectedstring $constructedObjectId True when parent::__construct has been called. from ObjectInitialisation
staticprotectedcallable|null $serializer The custom Carbon JSON serializer.
protectedstring[] $dumpProperties List of key to use for dump/serialization.
protectedstring|null $dumpLocale Locale to dump comes here before serialization.
protectedarray|null $dumpDateProperties Embed date properties to dump in a dedicated variables so it won't overlap native DateTime ones.
int $year
int $month
int $daysInMonth
int $quarter Depends on the following methods:

Methods

string
serialize()

Return a serialized string of the instance.

static Serialization
fromSerialized(string$value)

Create an instance from a serialized string.

static 
__set_state($dump)

No description

array
__sleep()

Returns the list of properties to dump on serialize() called on.

__serialize()

No description

__wakeup()

No description

__unserialize(array$data)

No description

jsonSerialize()

No description

static void
serializeUsing(callable$callback)deprecated

No description

cleanupDumpProperties()

Cleanup properties attached to the public scope of DateTime when a dump of the date is requested.

string|static
locale(string $locale =null)

No description

string
toJSON()

No description

Details

at line73
string serialize()

Return a serialized string of the instance.

Return Value

string

at line87
staticSerialization fromSerialized(string$value)

Create an instance from a serialized string.

Parameters

string $value

Return Value

Serialization

Exceptions

InvalidFormatException

at line106
static __set_state($dump)

Parameters

$dump

at line125
array __sleep()

Returns the list of properties to dump on serialize() called on.

Return Value

array

at line137
__serialize()

at line176
__wakeup()

at line204
__unserialize(array$data)

Parameters

array $data

at line235
jsonSerialize()

at line258
staticvoid serializeUsing(callable$callback)deprecated

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.

Parameters

callable $callback

Return Value

void

at line270
cleanupDumpProperties()

Cleanup properties attached to the public scope of DateTime when a dump of the date is requested.

foreach ($date as $_) {} serializer($date) var_export($date) get_object_vars($date)

at line35
string|static locale(string $locale =null)

Parameters

string $locale

Return Value

string|static

at line35
string toJSON()

Return Value

string