class AbstractElementCollection extends ArrayObject (View source)

Represents a list of elements.

Properties

protected string $elementClass Element class, that is allowed in the collection.

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

Details

__construct(array $elements = array())

Initializes collection with a list of elements.

Parameters

array $elements Elements.

Exceptions

ElementCollectionException When collection has invalid collection class.

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