library/QATools/QATools/PageObject/Element/AbstractElementCollection.php
public static function fromNodeElements(
		array $node_elements,
		$element_class = null,
		IPageFactory $page_factory
	) {
		$collection = new static();

		if ( !isset($element_class) ) {
			$element_class = $collection->elementClass;
		}

		if ( !$collection->isNodeElementAware($element_class) ) {
			throw new ElementCollectionException(
				sprintf('Collection element class "%s" must implement INodeElementAware interface', $element_class),
				ElementCollectionException::TYPE_INCORRECT_ELEMENT_CLASS
			);
		}

		foreach ( $node_elements as $node_element ) {
			$collection[] = call_user_func(array($element_class, 'fromNodeElement'), $node_element, $page_factory);
		}

		return $collection;
	}
public static function fromNodeElements(
		array $node_elements,
		$element_class = null,
		IPageFactory $page_factory
	) {
		$collection = new static();

		if ( !isset($element_class) ) {
			$element_class = $collection->elementClass;
		}

		if ( !$collection->isNodeElementAware($element_class) ) {
			throw new ElementCollectionException(
				sprintf('Collection element class "%s" must implement INodeElementAware interface', $element_class),
				ElementCollectionException::TYPE_INCORRECT_ELEMENT_CLASS
			);
		}

		foreach ( $node_elements as $node_element ) {
			$collection[] = call_user_func(array($element_class, 'fromNodeElement'), $node_element, $page_factory);
		}

		return $collection;
	}
public static function fromNodeElements ( array $ node_elements , $ element_class = null , IPageFactory $ page_factory ) { $ collection = new static ( ) ; if ( ! isset ( $ element_class ) ) { $ element_class = $ collection -> elementClass ; } if ( ! $ collection -> isNodeElementAware ( $ element_class ) ) { throw new ElementCollectionException ( sprintf ( 'Collection element class "%s" must implement INodeElementAware interface' , $ element_class ) , ElementCollectionException :: TYPE_INCORRECT_ELEMENT_CLASS ) ; } foreach ( $ node_elements as $ node_element ) { $ collection [ ] = call_user_func ( array ( $ element_class , 'fromNodeElement' ) , $ node_element , $ page_factory ) ; } return $ collection ; }
Creates new collection by wrapping given array of Node elements.

@param array|NodeElement[] $node_elements Node elements to wrap.
@param string              $element_class Class name to wrap Node elements with.
@param IPageFactory        $page_factory  Page factory (optional) to use during wrapping.

@return static
@throws ElementCollectionException When element class used doesn't allow adding NodeElements inside.
Creates new collection by wrapping given array of Node elements .