class Attribute implements ConfigProvider

Traits

Provides magic get, set, isset and unset implementations

Properties

protected array $markedSafe from  TemplateSafeness
mixed $defaultValue

Default value used for this attribute

AttributeFilterChain $filterChain

This attribute's filter chain

bool $required

Whether this attribute is required for the tag to be valid

Methods

mixed
__get(string $propName)

Magic getter

void
__set(string $propName, mixed $propValue)

Magic setter

bool
__isset(string $propName)

Test whether a property is set

void
__unset(string $propName)

Unset a property, if the class supports it

bool
isSafe(string $context)

Return whether this attribute is safe to be used in given context

bool
isSafeAsURL()

Return whether this object is safe to be used as a URL

bool
isSafeInCSS()

Return whether this object is safe to be used in CSS

bool
isSafeInJS()

Return whether this object is safe to be used in JavaScript

markAsSafeAsURL()

Return whether this object is safe to be used as a URL

markAsSafeInCSS()

Return whether this object is safe to be used in CSS

markAsSafeInJS()

Return whether this object is safe to be used in JavaScript

resetSafeness()

Reset the "marked safe" statuses

__construct(array|null $options = null)

Constructor

array|Dictionary|null
asConfig()

Return an array-based representation of this object to be used for parsing

Details

in Configurable at line 30
mixed __get(string $propName)

Magic getter

Will return $this->foo if it exists, then $this->getFoo() or will throw an exception if neither exists

Parameters

string $propName

Return Value

mixed

in Configurable at line 61
void __set(string $propName, mixed $propValue)

Magic setter

Will call $this->setFoo($propValue) if it exists, otherwise it will set $this->foo. If $this->foo is a NormalizedCollection, we do not replace it, instead we clear() it then fill it back up. It will not overwrite an object with a different incompatible object (of a different, non-extending class) and it will throw an exception if the PHP type cannot match without incurring data loss.

Parameters

string $propName
mixed $propValue

Return Value

void

in Configurable at line 147
bool __isset(string $propName)

Test whether a property is set

Parameters

string $propName

Return Value

bool

in Configurable at line 164
void __unset(string $propName)

Unset a property, if the class supports it

Parameters

string $propName

Return Value

void

at line 66
protected bool isSafe(string $context)

Return whether this attribute is safe to be used in given context

Parameters

string $context

Either 'AsURL', 'InCSS' or 'InJS'

Return Value

bool

in TemplateSafeness at line 34
bool isSafeAsURL()

Return whether this object is safe to be used as a URL

Return Value

bool

in TemplateSafeness at line 44
bool isSafeInCSS()

Return whether this object is safe to be used in CSS

Return Value

bool

in TemplateSafeness at line 54
bool isSafeInJS()

Return whether this object is safe to be used in JavaScript

Return Value

bool

in TemplateSafeness at line 64
TemplateSafeness markAsSafeAsURL()

Return whether this object is safe to be used as a URL

Return Value

TemplateSafeness

in TemplateSafeness at line 76
TemplateSafeness markAsSafeInCSS()

Return whether this object is safe to be used in CSS

Return Value

TemplateSafeness

in TemplateSafeness at line 88
TemplateSafeness markAsSafeInJS()

Return whether this object is safe to be used in JavaScript

Return Value

TemplateSafeness

in TemplateSafeness at line 100
TemplateSafeness resetSafeness()

Reset the "marked safe" statuses

Return Value

TemplateSafeness

at line 47
__construct(array|null $options = null)

Constructor

Parameters

array|null $options

This attribute's options

at line 85
array|Dictionary|null asConfig()

Return an array-based representation of this object to be used for parsing

NOTE: if this method was named getConfig() it could interfere with magic getters from the Configurable trait

Return Value

array|Dictionary|null