interface IBlock implements IPart, ISearchContext (View source)

Interface, that every BEM block must implement.

Methods

string
getName()

Returns name of the entity.

from INamed
Expectation
shouldReceive(string $name)

No description

from INamed
NodeElement|null
find(string $selector, string|array $locator)

Finds first element with specified selector.

NodeElement[]
findAll(string $selector, string|array $locator)

Finds all elements with specified selector.

mixed
waitFor(integer $timeout, callable $callback)

Waits for an element(-s) to appear and returns it.

NodeElement[]
getNodes()

Returns block nodes.

NodeElement[]|null
getElement(string $element_name, string $modificator_name = null, string $modificator_value = null)

Returns first block element.

NodeElement[]
getElements(string $element_name, string $modificator_name = null, string $modificator_value = null)

Returns all block elements.

Details

string getName()

Returns name of the entity.

Return Value

string

Expectation shouldReceive(string $name)

Parameters

string $name

Return Value

Expectation

NodeElement|null find(string $selector, string|array $locator)

Finds first element with specified selector.

Parameters

string $selector Selector engine name.
string|array $locator Selector locator.

Return Value

NodeElement|null

NodeElement[] findAll(string $selector, string|array $locator)

Finds all elements with specified selector.

Parameters

string $selector Selector engine name.
string|array $locator Selector locator.

Return Value

NodeElement[]

mixed waitFor(integer $timeout, callable $callback)

Waits for an element(-s) to appear and returns it.

Parameters

integer $timeout Maximal allowed waiting time in seconds.
callable $callback Callback, which result is both used as waiting condition and returned. Will receive reference to this element as first argument.

Return Value

mixed

Exceptions

InvalidArgumentException When invalid callback given.

NodeElement[] getNodes()

Returns block nodes.

Return Value

NodeElement[]

NodeElement[]|null getElement(string $element_name, string $modificator_name = null, string $modificator_value = null)

Returns first block element.

Parameters

string $element_name Element name.
string $modificator_name Modificator name.
string $modificator_value Modificator value.

Return Value

NodeElement[]|null

NodeElement[] getElements(string $element_name, string $modificator_name = null, string $modificator_value = null)

Returns all block elements.

Parameters

string $element_name Element name.
string $modificator_name Modificator name.
string $modificator_value Modificator value.

Return Value

NodeElement[]