interface EntityTypeSerializerInterface (View source)

Interface for entity-specific serializers in the strategy pattern.

Each entity type (PHPClass, PHPFunction, etc.) has its own serializer implementation.

Methods

bool
supports(mixed $entity)

Check if this serializer supports the given entity.

array
serialize(mixed $entity, PhpDocRepository|null $phpDocStorage = null)

Serialize an entity to array format suitable for JSON encoding.

mixed
deserialize(array $data, PhpDocRepository|null $phpDocStorage = null)

Deserialize an entity from array format.

Details

bool supports(mixed $entity)

Check if this serializer supports the given entity.

Parameters

mixed $entity

The entity to check

Return Value

bool

True if this serializer can handle the entity

array serialize(mixed $entity, PhpDocRepository|null $phpDocStorage = null)

Serialize an entity to array format suitable for JSON encoding.

Parameters

mixed $entity

The entity to serialize

PhpDocRepository|null $phpDocStorage

Optional PhpDoc storage for external storage

Return Value

array

The serialized entity data

mixed deserialize(array $data, PhpDocRepository|null $phpDocStorage = null)

Deserialize an entity from array format.

Parameters

array $data

The serialized entity data

PhpDocRepository|null $phpDocStorage

Optional PhpDoc storage for external retrieval

Return Value

mixed

The reconstructed entity object