ComponentAttributeBag
class ComponentAttributeBag implements ArrayAccess, IteratorAggregate, JsonSerializable, Htmlable, Stringable (View source)
Traits
Properties
static protected array | $macros | The registered string macros. |
from Macroable |
protected array | $attributes | The raw array of attributes. |
Methods
Apply the callback if the given "value" is (or resolves to) truthy.
Apply the callback if the given "value" is (or resolves to) falsy.
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Create a new component attribute bag instance.
Get all of the attribute values.
Get the first attribute's value.
Get a given attribute from the attribute array.
Determine if a given attribute exists in the attribute array.
Determine if any of the keys exist in the attribute array.
Determine if a given attribute is missing from the attribute array.
Only include the given attribute from the attribute array.
Exclude the given attribute from the attribute array.
Filter the attributes, returning a bag of attributes that pass the filter.
Return a bag of attributes that have keys starting with the given value / pattern.
Return a bag of attributes with keys that do not start with the given value / pattern.
Return a bag of attributes that have keys starting with the given value / pattern.
Only include the given attribute from the attribute array.
Exclude the given attribute from the attribute array.
Conditionally merge classes into the attribute bag.
Conditionally merge styles into the attribute bag.
Merge additional attributes / values into the attribute bag.
Determine if the specific attribute value should be escaped.
Create a new appendable attribute value.
Resolve an appendable attribute value default value.
Determine if the attribute bag is empty.
Determine if the attribute bag is not empty.
Get all of the raw attributes.
Set the underlying attributes.
Extract "prop" names from given keys.
Get content as a string of HTML.
Merge additional attributes / values into the attribute bag.
Determine if the given offset exists.
Get the value at the given offset.
Set the value at a given offset.
Remove the value at the given offset.
Get an iterator for the items.
Convert the object into a JSON serializable form.
Implode the attributes into a single HTML ready string.
Details
$this|TWhenReturnType
when($value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) truthy.
$this|TUnlessReturnType
unless($value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) falsy.
ComponentAttributeBag
except(mixed|array $keys)
Exclude the given attribute from the attribute array.
ComponentAttributeBag
filter(callable $callback)
Filter the attributes, returning a bag of attributes that pass the filter.
ComponentAttributeBag
whereStartsWith(string|string[] $needles)
Return a bag of attributes that have keys starting with the given value / pattern.
ComponentAttributeBag
whereDoesntStartWith(string|string[] $needles)
Return a bag of attributes with keys that do not start with the given value / pattern.
ComponentAttributeBag
thatStartWith(string|string[] $needles)
Return a bag of attributes that have keys starting with the given value / pattern.
ComponentAttributeBag
onlyProps(mixed|array $keys)
Only include the given attribute from the attribute array.
ComponentAttributeBag
exceptProps(mixed|array $keys)
Exclude the given attribute from the attribute array.
ComponentAttributeBag
class(mixed|array $classList)
Conditionally merge classes into the attribute bag.
ComponentAttributeBag
style(mixed|array $styleList)
Conditionally merge styles into the attribute bag.
ComponentAttributeBag
merge(array $attributeDefaults = [], bool $escape = true)
Merge additional attributes / values into the attribute bag.
protected bool
shouldEscapeAttributeValue(bool $escape, mixed $value)
Determine if the specific attribute value should be escaped.
protected mixed
resolveAppendableAttributeDefault(array $attributeDefaults, string $key, bool $escape)
Resolve an appendable attribute value default value.
HtmlString
__invoke(array $attributeDefaults = [])
Merge additional attributes / values into the attribute bag.