Skip to content
PHP Ecosystem
Explore

SimpleFactory

API reference › HTML Core › Factory › SimpleFactory

final classUIAwesome\Html\Core\Factory\SimpleFactory
Sourcesrc/Factory/SimpleFactory.php

Creates and configures tag instances from cookbook-style definitions.

MethodDescriptionDefined by
configure() staticApplies configuration values to a tag instance.SimpleFactory
create() staticCreates a non-abstract tag instance by class name.SimpleFactory
public static function configure(UIAwesome\Html\Core\Base\BaseTag $tag, array $defaults): UIAwesome\Html\Core\Base\BaseTag

Applies configuration values to a tag instance.

Keys resolve to methods first, then to properties, and must name a public instance member. A method must return an instance of the tag class, such as the clone returned by an immutable setter. A numeric key, or a key matching no method or property, aborts the configuration with ConfigException.

Property writes rejected at runtime, such as readonly, asymmetric visibility, or type mismatches, surface as ConfigException with the original Error attached as the previous exception.

Parameters

ParameterTypeDescription
$tagUIAwesome\Html\Core\Base\BaseTagTag instance to configure.
$defaultsarrayAssociative array of method names and arguments.

Returns

UIAwesome\Html\Core\Base\BaseTag: Configured tag instance.

Throws

  • UIAwesome\Html\Core\Exception\ConfigException: if a key is numeric, matches no method or property, resolves to a method that is not a public instance method or does not return an instance of the tag class, resolves to a property that is not a public instance property, or resolves to a public property that rejects the write.
public static function create(string $class): UIAwesome\Html\Core\Base\BaseTag

Creates a non-abstract tag instance by class name.

Parameters

ParameterTypeDescription
$classstringTag class name.

Returns

UIAwesome\Html\Core\Base\BaseTag: Instantiated tag object.

Throws