class CreationExtensions implements Transient

The casts, normalizers and automatic lazy attributes resolved for one creation operation.

Everything an operation creates shares one instance, including nested values and deferred lazy collection items, so each extension is resolved once and the same instance handles every matching value.

Properties

protected Cast> $attributeCasts
protected Cast> $casts
protected Normalizer>> $classNormalizers
protected Normalizer> $normalizers
protected AutoLazy> $autoLazies
protected CastableCast> $castableCasts
protected DateTimeInterfaceCast> $dateCasts
protected EnumCast> $enumCasts
protected BuiltinTypeCast> $builtinCasts

Methods

__construct(Container $container, DataConfig $config)

Create the extensions for one creation operation.

array
propertyCasts(DataProperty $property, CreationContext $context)

Get the ordered custom casts applicable to a property.

array
itemCasts(DataProperty $property, NamedType $type, CreationContext $context)

Get the factory and configured casts for one plain iterable type's items.

array
normalizers(DataClass $dataClass, CreationContext $context)

Get the custom normalizers for one data class.

autoLazy(DataProperty $property)

Get the automatic lazy attribute instance for a property.

castableCast(string $class)

Get the cast for a Castable class.

dateCast(string $type)

Get the built-in cast for a date type.

enumCast(string $type)

Get the built-in cast for a backed enum type.

builtinCast(string $type)

Get the built-in cast for a scalar or array type.

cast(Cast|string $cast)

Resolve one cast once for the operation.

Details

at line 61
__construct(Container $container, DataConfig $config)

Create the extensions for one creation operation.

Parameters

Container $container
DataConfig $config

at line 72
array propertyCasts(DataProperty $property, CreationContext $context)

Get the ordered custom casts applicable to a property.

Parameters

DataProperty $property
CreationContext $context

Return Value

array

at line 106
array itemCasts(DataProperty $property, NamedType $type, CreationContext $context)

Get the factory and configured casts for one plain iterable type's items.

Parameters

DataProperty $property
NamedType $type
CreationContext $context

Return Value

array

at line 128
array normalizers(DataClass $dataClass, CreationContext $context)

Get the custom normalizers for one data class.

Parameters

DataClass $dataClass
CreationContext $context

Return Value

array

at line 166
AutoLazy autoLazy(DataProperty $property)

Get the automatic lazy attribute instance for a property.

Parameters

DataProperty $property

Return Value

AutoLazy

at line 179
CastableCast castableCast(string $class)

Get the cast for a Castable class.

Parameters

string $class

Return Value

CastableCast

at line 187
DateTimeInterfaceCast dateCast(string $type)

Get the built-in cast for a date type.

Parameters

string $type

Return Value

DateTimeInterfaceCast

at line 195
EnumCast enumCast(string $type)

Get the built-in cast for a backed enum type.

Parameters

string $type

Return Value

EnumCast

at line 203
BuiltinTypeCast builtinCast(string $type)

Get the built-in cast for a scalar or array type.

Parameters

string $type

Return Value

BuiltinTypeCast

at line 213
protected Cast cast(Cast|string $cast)

Resolve one cast once for the operation.

Parameters

Cast|string $cast

Return Value

Cast