SimpleFactory
API reference › HTML Core › Factory › SimpleFactory
Creates and configures tag instances from cookbook-style definitions.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
configure() static | Applies configuration values to a tag instance. | SimpleFactory |
create() static | Creates a non-abstract tag instance by class name. | SimpleFactory |
Method details
Section titled “Method details”configure()
Section titled “configure() ”public static function configure(UIAwesome\Html\Core\Base\BaseTag $tag, array $defaults): UIAwesome\Html\Core\Base\BaseTagApplies 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
| Parameter | Type | Description |
|---|---|---|
$tag | UIAwesome\ | Tag instance to configure. |
$defaults | array | Associative 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.
create()
Section titled “create() ”public static function create(string $class): UIAwesome\Html\Core\Base\BaseTagCreates a non-abstract tag instance by class name.
Parameters
| Parameter | Type | Description |
|---|---|---|
$class | string | Tag class name. |
Returns
UIAwesome\Html\Core\Base\BaseTag: Instantiated tag object.
Throws
LogicException: if the class is abstract and cannot be instantiated.ReflectionException