JsonCodec
Interfaces to serialize and deserialize PHP objects to/from JSON
Loading...
Searching...
No Matches
Wikimedia\JsonCodec\JsonCodecable Interface Reference

Classes implementing this interface support round-trip JSON serialization/deserialization via a JsonClassCodec object (which may maintain state and/or consult service objects). More...

Static Public Member Functions

static jsonClassCodec (JsonCodecInterface $codec, ContainerInterface $serviceContainer)
 Create a JsonClassCodec which can serialize/deserialize instances of this class.
 

Detailed Description

Classes implementing this interface support round-trip JSON serialization/deserialization via a JsonClassCodec object (which may maintain state and/or consult service objects).

It requires a single static method to be defined which allows the creation of an appropriate JsonClassCodec for this class.

Member Function Documentation

◆ jsonClassCodec()

static Wikimedia\JsonCodec\JsonCodecable::jsonClassCodec ( JsonCodecInterface  $codec,
ContainerInterface  $serviceContainer 
)
static

Create a JsonClassCodec which can serialize/deserialize instances of this class.

Parameters
JsonCodecInterface$codecA codec which can be used to handle certain cases of implicit typing in the generated JSON; see JsonCodecInterface for details. It should not be necessary for most class codecs to use this, as recursive serialization/deserialization is handled by default.
ContainerInterface$serviceContainerA service container
Returns
JsonClassCodec A JsonClassCodec appropriate for objects of this type.

The documentation for this interface was generated from the following file: