class ComponentAttributeBag implements ArrayAccess, Htmlable, IteratorAggregate (View source)

Properties

protected array $attributes The raw array of attributes.

Methods

void
__construct(array $attributes = [])

Create a new component attribute bag instance.

mixed
get(string $key, mixed $default = null)

Get a given attribute from the attribute array.

only(mixed|array $keys)

Only include the given attribute from the attribute array.

except(mixed|array $keys)

Exclude the given attribute from the attribute array.

exceptProps(mixed|array $keys)

Exclude the given attribute from the attribute array.

merge(array $attributeDefaults = [])

Merge additional attributes / values into the attribute bag.

void
setAttributes(array $attributes)

Set the underlying attributes.

string
toHtml()

Get content as a string of HTML.

__invoke(array $attributeDefaults = [])

Merge additional attributes / values into the attribute bag.

bool
offsetExists(string $offset)

Determine if the given offset exists.

mixed
offsetGet(string $offset)

Get the value at the given offset.

void
offsetSet(string $offset, mixed $value)

Set the value at a given offset.

void
offsetUnset(string $offset)

Remove the value at the given offset.

getIterator()

Get an iterator for the items.

string
__toString()

Implode the attributes into a single HTML ready string.

Details

void __construct(array $attributes = [])

Create a new component attribute bag instance.

Parameters

array $attributes

Return Value

void

mixed get(string $key, mixed $default = null)

Get a given attribute from the attribute array.

Parameters

string $key
mixed $default

Return Value

mixed

ComponentAttributeBag only(mixed|array $keys)

Only include the given attribute from the attribute array.

Parameters

mixed|array $keys

Return Value

ComponentAttributeBag

ComponentAttributeBag except(mixed|array $keys)

Exclude the given attribute from the attribute array.

Parameters

mixed|array $keys

Return Value

ComponentAttributeBag

ComponentAttributeBag exceptProps(mixed|array $keys)

Exclude the given attribute from the attribute array.

Parameters

mixed|array $keys

Return Value

ComponentAttributeBag

ComponentAttributeBag merge(array $attributeDefaults = [])

Merge additional attributes / values into the attribute bag.

Parameters

array $attributeDefaults

Return Value

ComponentAttributeBag

void setAttributes(array $attributes)

Set the underlying attributes.

Parameters

array $attributes

Return Value

void

string toHtml()

Get content as a string of HTML.

Return Value

string

HtmlString __invoke(array $attributeDefaults = [])

Merge additional attributes / values into the attribute bag.

Parameters

array $attributeDefaults

Return Value

HtmlString

bool offsetExists(string $offset)

Determine if the given offset exists.

Parameters

string $offset

Return Value

bool

mixed offsetGet(string $offset)

Get the value at the given offset.

Parameters

string $offset

Return Value

mixed

void offsetSet(string $offset, mixed $value)

Set the value at a given offset.

Parameters

string $offset
mixed $value

Return Value

void

void offsetUnset(string $offset)

Remove the value at the given offset.

Parameters

string $offset

Return Value

void

ArrayIterator getIterator()

Get an iterator for the items.

Return Value

ArrayIterator

string __toString()

Implode the attributes into a single HTML ready string.

Return Value

string