class RadioGroup extends AbstractTypifiedElementCollection implements ISimpleSetter (View source)

Represents a group of radio buttons.

Properties

protected string $elementClass Element class, that is allowed in the collection. from AbstractElementCollection
private string $_name Name of the element. from AbstractTypifiedElementCollection

Methods

__construct(array $elements = array())

Initializes collection with a list of elements.

boolean
acceptElement(mixed $element)

Determines if an element can be added to a collection.

void
offsetSet(mixed $index, mixed $newval)

Offset to set.

fromNodeElements(array $node_elements, string $element_class = null, IPageFactory $page_factory)

Creates new collection by wrapping given array of Node elements.

boolean
isNodeElementAware(string $class_name)

Determines if class is NodeElement aware.

boolean
assertElement(mixed $element)

Checks that element's class is allowed in collection.

Expectation
shouldReceive(string $name)

No description

setName(string $name)

Sets a name of an element.

string
getName()

Returns name of the entity.

boolean
hasSelectedButton()

Indicates if radio has selected button.

getSelectedButton()

Returns selected radio button.

selectButtonByLabelText(string $text)

Selects radio button, that contains given text.

selectButtonByValue(string $value)

Selects radio button that have a value matching the specified argument.

selectButtonByIndex(integer $index)

Selects radio button by the given index.

setValue(mixed $value)

Sets value to the element.

Details

__construct(array $elements = array())

Initializes collection with a list of elements.

Parameters

array $elements Elements.

protected boolean acceptElement(mixed $element)

Determines if an element can be added to a collection.

Parameters

mixed $element Element.

Return Value

boolean

void offsetSet(mixed $index, mixed $newval)

Offset to set.

Parameters

mixed $index The offset to assign the value to.
mixed $newval The value to set.

Return Value

void

static AbstractElementCollection fromNodeElements(array $node_elements, string $element_class = null, IPageFactory $page_factory)

Creates new collection by wrapping given array of Node elements.

Parameters

array $node_elements Node elements to wrap.
string $element_class Class name to wrap Node elements with.
IPageFactory $page_factory Page factory (optional) to use during wrapping.

Return Value

AbstractElementCollection

Exceptions

ElementCollectionException When element class used doesn't allow adding NodeElements inside.

protected boolean isNodeElementAware(string $class_name)

Determines if class is NodeElement aware.

Parameters

string $class_name Class name.

Return Value

boolean

protected boolean assertElement(mixed $element)

Checks that element's class is allowed in collection.

Parameters

mixed $element Element.

Return Value

boolean

Exceptions

ElementCollectionException When class of given element doesn't match one, that collection accepts.

Expectation shouldReceive(string $name)

Parameters

string $name

Return Value

Expectation

ITypifiedElement setName(string $name)

Sets a name of an element.

This method is used by initialization mechanism and is not intended to be used directly.

Parameters

string $name Name to set.

Return Value

ITypifiedElement

string getName()

Returns name of the entity.

Return Value

string

boolean hasSelectedButton()

Indicates if radio has selected button.

Return Value

boolean

RadioButton getSelectedButton()

Returns selected radio button.

Return Value

RadioButton Element, that represents selected radio button or {@code null} if no radio buttons are selected.

Exceptions

RadioGroupException When no radio button is selected.

RadioGroup selectButtonByLabelText(string $text)

Selects radio button, that contains given text.

Parameters

string $text Text.

Return Value

RadioGroup

Exceptions

RadioGroupException When radio button with given label text wasn't found.

RadioGroup selectButtonByValue(string $value)

Selects radio button that have a value matching the specified argument.

Parameters

string $value The value to match against.

Return Value

RadioGroup

Exceptions

RadioGroupException When radio button with given value wasn't found.

RadioGroup selectButtonByIndex(integer $index)

Selects radio button by the given index.

Parameters

integer $index Index of a radio button to be selected.

Return Value

RadioGroup

Exceptions

RadioGroupException When non-existing index was given.

ISimpleSetter setValue(mixed $value)

Sets value to the element.

Parameters

mixed $value New value.

Return Value

ISimpleSetter