Methods |
public
static
|
getService<T is object>(
ContainerInterface $container,
class-string<T> $service,
): static<T, AbstractProvider, AbstractEntity, ProviderContext<AbstractProvider, AbstractEntity>>
Get an introspector for a service
Get an introspector for a service
Uses a container to resolve a service to a concrete class and returns an
introspector for it.
Overriden by
|
#
|
public
static
|
get<T is object>(
class-string<T> $class,
): static<T, AbstractProvider, AbstractEntity, ProviderContext<AbstractProvider, AbstractEntity>>
Get an introspector for a class
Get an introspector for a class
Overriden by
|
#
|
final
protected
|
__construct(
class-string $service,
class-string<TClass> $class,
class-string<TProvider> $provider,
class-string<TEntity> $entity,
class-string<TContext> $context,
)
Creates a new Introspector object
Creates a new Introspector object
|
#
|
protected
|
getIntrospectionClass(class-string<TClass> $class): IntrospectionClass<TClass>
|
#
|
final
public
|
__call(string $name, mixed[] $arguments): mixed
|
#
|
final
public
|
__get(string $name): mixed
|
#
|
final
public
|
maybeNormalise<T is string[]|string>(T $value, int-mask-of<NormaliserFlag::*> $flags = NormaliserFlag::GREEDY): T
Normalise strings if the class has a normaliser, otherwise return them
as-is
Normalise strings if the class has a normaliser, otherwise return them
as-is
|
#
|
final
public
|
hasNormaliser(): bool
True if the class has a normaliser
True if the class has a normaliser
|
#
|
final
public
|
getCreateFromClosure(
bool $strict = false,
): Closure(mixed[], ContainerInterface, DateFormatterInterface|null, Treeable|null): TClass
Get a closure that creates instances of the class from arrays
Get a closure that creates instances of the class from arrays
Wraps {@see Introspector::getCreateFromSignatureClosure()} in a closure
that resolves array signatures to closures on-demand.
Parameters
$strict |
If true , the closure will throw an exception if it
receives any data that would be discarded.
|
|
#
|
final
public
|
getCreateFromSignatureClosure(
string[] $keys,
bool $strict = false,
): Closure(mixed[], ContainerInterface, DateFormatterInterface|null, Treeable|null): TClass
Get a closure that creates instances of the class from arrays with a
given signature
Get a closure that creates instances of the class from arrays with a
given signature
Parameters
$strict |
If true , throw an exception if any data would be
discarded.
|
|
#
|
final
public
|
getCreateProvidableFromClosure(bool $strict = false): Closure(mixed[], TProvider, TContext): TClass
Get a closure that creates provider-serviced instances of the class from
arrays
Get a closure that creates provider-serviced instances of the class from
arrays
Wraps {@see Introspector::getCreateProvidableFromSignatureClosure()} in a
closure that resolves array signatures to closures on-demand.
Parameters
$strict |
If true , the closure will throw an exception if it
receives any data that would be discarded.
|
|
#
|
final
public
|
getCreateProvidableFromSignatureClosure(
string[] $keys,
bool $strict = false,
): Closure(mixed[], TProvider, TContext): TClass
Get a closure that creates provider-serviced instances of the class from
arrays with a given signature
Get a closure that creates provider-serviced instances of the class from
arrays with a given signature
Parameters
$strict |
If true , throw an exception if any data would be
discarded.
|
|
#
|
protected
|
getKeyTargets(
string[] $keys,
bool $forNewInstance,
bool $strict,
bool $normalised = false,
array<static::*_KEY, string> $customKeys = [],
array<string, Closure(mixed[] $data, string|null $service, TClass $entity, TProvider|null, TContext|null): void> $keyClosures = [],
): IntrospectorKeyTargets<static, TClass, TProvider, TContext>
Get a list of actions required to apply values from an array to a new or
existing instance of the class
Get a list of actions required to apply values from an array to a new or
existing instance of the class
Parameters
$forNewInstance |
If true , keys are matched with constructor
parameters if possible.
|
$strict |
If true , an exception is thrown if any keys cannot
be applied to the class.
|
$normalised |
If true , the $keys array has already been
normalised.
|
$customKeys |
An array that maps key
types to keys as they appear in $keys .
|
$keyClosures |
Normalised key => closure
|
Overriden by
|
#
|
final
protected
|
_getConstructor(
IntrospectorKeyTargets<out static, TClass, TProvider, TContext> $targets,
): Closure(mixed[], class-string|null, ContainerInterface): TClass
|
#
|
final
public
|
getPropertyActionClosure(string $name, string $action): Closure
Get a static closure to perform an action on a property of the class
Get a static closure to perform an action on a property of the class
If $name and $action correspond to a "magic" property method (e.g.
_get<Property>() ), a closure to invoke the method is returned.
Otherwise, if $name corresponds to an accessible declared property, or
the class implements {@see Extensible}), a closure to perform the
requested $action on the property directly is returned.
Fails with an exception if {@see Extensible} is not implemented and no
declared or "magic" property matches $name and $action .
Closure signature:
static function ($instance, ...$params)
Parameters
$action |
Either {@see IntrospectionClass::ACTION_SET},
{@see IntrospectionClass::ACTION_GET},
{@see IntrospectionClass::ACTION_ISSET} or
{@see IntrospectionClass::ACTION_UNSET}.
|
|
#
|
final
public
|
hasProperty(string $name): bool
Check if a property is declared or has a "magic" property method
Check if a property is declared or has a "magic" property method
|
#
|
final
public
|
getGetNameClosure(): Closure(TClass): string
Get a closure that returns the name of an instance on a best-effort basis
Get a closure that returns the name of an instance on a best-effort basis
Intended for use in default {@see HasName::getName()} implementations.
Instance names are returned from properties most likely to contain them.
|
#
|
final
public
|
getSerializeClosure(SerializeRulesInterface<TClass>|null $rules = null): Closure
|
#
|
final
protected
|
_getUpdater(
IntrospectorKeyTargets<out static, TClass, TProvider, TContext> $targets,
): Closure(mixed[], TClass, ContainerInterface, TProvider|null, TContext|null, DateFormatterInterface|null, Treeable|null): TClass
|
#
|
final
protected
|
_getResolver(
IntrospectorKeyTargets<out static, TClass, TProvider, TContext> $targets,
): Closure(mixed[], string|null, TClass, TProvider|null, TContext|null): TClass
|
#
|
public
|
getReadableProperties(): string[]
Get readable properties, including "magic" properties
Get readable properties, including "magic" properties
|
#
|
public
|
getWritableProperties(): string[]
Get writable properties, including "magic" properties
Get writable properties, including "magic" properties
|
#
|
public
|
propertyActionIsAllowed(string $property, IntrospectionClass::ACTION_* $action): bool
True if an action can be performed on a property
True if an action can be performed on a property
|
#
|
Properties |
protected
|
IntrospectionClass<TClass>
|
$_Class
|
#
|
protected
|
class-string|null
|
$_Service
|
#
|
protected
|
class-string<TProvider>
|
$_Provider
|
#
|
protected
|
class-string<TEntity>
|
$_Entity
|
#
|
protected
|
class-string<TContext>
|
$_Context
|
#
|
public
readonly
|
class-string<TClass>
|
$Class
The name of the class under introspection
The name of the class under introspection
|
#
|
public
readonly
|
bool
|
$IsReadable
True if the class implements Readable
True if the class implements Readable
|
#
|
public
readonly
|
bool
|
$IsWritable
True if the class implements Writable
True if the class implements Writable
|
#
|
public
readonly
|
bool
|
$IsExtensible
True if the class implements Extensible
True if the class implements Extensible
|
#
|
public
readonly
|
bool
|
$IsProvidable
True if the class implements Providable
True if the class implements Providable
|
#
|
public
readonly
|
bool
|
$IsRelatable
True if the class implements Relatable
True if the class implements Relatable
|
#
|
public
readonly
|
bool
|
$IsTreeable
True if the class implements Treeable
True if the class implements Treeable
|
#
|
public
readonly
|
bool
|
$HasDates
True if the class implements Temporal
True if the class implements Temporal
|
#
|
public
readonly
|
array<string, string>
|
$Properties
Properties (normalised name => declared name)
Properties (normalised name => declared name)
|
#
|
public
readonly
|
array<string, string>
|
$PublicProperties
Public properties (normalised name => declared name)
Public properties (normalised name => declared name)
|
#
|
public
readonly
|
array<string, string>
|
$ReadableProperties
Readable properties (normalised name => declared name)
Readable properties (normalised name => declared name)
|
#
|
public
readonly
|
array<string, string>
|
$WritableProperties
Writable properties (normalised name => declared name)
Writable properties (normalised name => declared name)
|
#
|
public
readonly
|
array<string, array<string, string>>
|
$Actions
Action => normalised property name => "magic" property method
Action => normalised property name => "magic" property method
|
#
|
public
readonly
|
array<string, string>
|
$Parameters
Constructor parameters (normalised name => declared name)
Constructor parameters (normalised name => declared name)
|
#
|
public
readonly
|
array<string, string>
|
$RequiredParameters
Parameters that aren't nullable and don't have a default value (normalised name => declared name)
Parameters that aren't nullable and don't have a default value (normalised name => declared name)
|
#
|
public
readonly
|
array<string, string>
|
$NotNullableParameters
Parameters that aren't nullable and have a default value (normalised name => declared name)
Parameters that aren't nullable and have a default value (normalised name => declared name)
|
#
|
public
readonly
|
array<string, string>
|
$ServiceParameters
Required parameters with a declared type that can be resolved by a service container (normalised name => class…
Required parameters with a declared type that can be resolved by a service container (normalised name => class/interface name)
|
#
|
public
readonly
|
array<string, string>
|
$PassByRefParameters
Parameters to pass by reference (normalised name => declared name)
Parameters to pass by reference (normalised name => declared name)
|
#
|
public
readonly
|
array<string, string>
|
$DateParameters
Parameters with a declared type that implements DateTimeInterface (normalised name => declared name)
Parameters with a declared type that implements DateTimeInterface (normalised name => declared name)
|
#
|
public
readonly
|
mixed[]
|
$DefaultArguments
Default values for (all) constructor parameters
Default values for (all) constructor parameters
|
#
|
public
readonly
|
int
|
$RequiredArguments
Minimum number of arguments required by the constructor
Minimum number of arguments required by the constructor
|
#
|
public
readonly
|
array<string, int>
|
$ParameterIndex
Constructor parameter name => index
Constructor parameter name => index
|
#
|
public
readonly
|
string[]
|
$SerializableProperties
Declared and "magic" properties that are both readable and writable
Declared and "magic" properties that are both readable and writable
|
#
|
public
readonly
|
string[]
|
$NormalisedKeys
Normalised properties (declared and "magic" property names)
Normalised properties (declared and "magic" property names)
|
#
|
public
readonly
|
string|null
|
$ParentProperty
The normalised parent property
The normalised parent property
|
#
|
public
readonly
|
string|null
|
$ChildrenProperty
The normalised children property
The normalised children property
|
#
|
public
readonly
|
array<string, class-string<Relatable>>
|
$OneToOneRelationships
One-to-one relationships between the class and others (normalised property name => target class)
One-to-one relationships between the class and others (normalised property name => target class)
|
#
|
public
readonly
|
array<string, class-string<Relatable>>
|
$OneToManyRelationships
One-to-many relationships between the class and others (normalised property name => target class)
One-to-many relationships between the class and others (normalised property name => target class)
|
#
|
public
readonly
|
string[]
|
$DateKeys
Normalised date properties (declared and "magic" property names)
Normalised date properties (declared and "magic" property names)
|
#
|