private function getRoot()
	{
		if ($this->root === NULL)
		{
			$selector = reset($this->parameters);
			$strategy = key($this->parameters);
			if ($selector instanceof Element)
			{
				$this->root = $selector;
			}
			else
			{
				$this->root = $this->parent->findElement($strategy, $selector);
			}
			$expectedTagName = next($this->parameters);
			$expectedAttributes = next($this->parameters);
			if ($expectedTagName !== FALSE)
			{
				$actualTagName = $this->root->name();
				if ($actualTagName !== $expectedTagName)
				{
					throw new ViewStateException("Root element of '" . get_class($this) . "' is expected to be tag '$expectedTagName', but is '$actualTagName'.");
				}
			}
			if ($expectedAttributes !== FALSE)
			{
				foreach ($expectedAttributes as $attributeName => $expectedAttributeValue)
				{
					$actualAttributeValue = $this->root->attribute($attributeName);
					if ($actualAttributeValue !== $expectedAttributeValue)
					{
						throw new ViewStateException("Root element's attribute '$attributeName' is expected to be '$expectedAttributeValue', but is '$actualAttributeValue'.");
					}
				}
			}
		}
		return $this->root;
	}
private function getRoot()
	{
		if ($this->root === NULL)
		{
			$selector = reset($this->parameters);
			$strategy = key($this->parameters);
			if ($selector instanceof Element)
			{
				$this->root = $selector;
			}
			else
			{
				$this->root = $this->parent->findElement($strategy, $selector);
			}
			$expectedTagName = next($this->parameters);
			$expectedAttributes = next($this->parameters);
			if ($expectedTagName !== FALSE)
			{
				$actualTagName = $this->root->name();
				if ($actualTagName !== $expectedTagName)
				{
					throw new ViewStateException("Root element of '" . get_class($this) . "' is expected to be tag '$expectedTagName', but is '$actualTagName'.");
				}
			}
			if ($expectedAttributes !== FALSE)
			{
				foreach ($expectedAttributes as $attributeName => $expectedAttributeValue)
				{
					$actualAttributeValue = $this->root->attribute($attributeName);
					if ($actualAttributeValue !== $expectedAttributeValue)
					{
						throw new ViewStateException("Root element's attribute '$attributeName' is expected to be '$expectedAttributeValue', but is '$actualAttributeValue'.");
					}
				}
			}
		}
		return $this->root;
	}
private function getRoot ( ) { if ( $ this -> root === NULL ) { $ selector = reset ( $ this -> parameters ) ; $ strategy = key ( $ this -> parameters ) ; if ( $ selector instanceof Element ) { $ this -> root = $ selector ; } else { $ this -> root = $ this -> parent -> findElement ( $ strategy , $ selector ) ; } $ expectedTagName = next ( $ this -> parameters ) ; $ expectedAttributes = next ( $ this -> parameters ) ; if ( $ expectedTagName !== FALSE ) { $ actualTagName = $ this -> root -> name ( ) ; if ( $ actualTagName !== $ expectedTagName ) { throw new ViewStateException ( "Root element of '" . get_class ( $ this ) . "' is expected to be tag '$expectedTagName', but is '$actualTagName'." ) ; } } if ( $ expectedAttributes !== FALSE ) { foreach ( $ expectedAttributes as $ attributeName => $ expectedAttributeValue ) { $ actualAttributeValue = $ this -> root -> attribute ( $ attributeName ) ; if ( $ actualAttributeValue !== $ expectedAttributeValue ) { throw new ViewStateException ( "Root element's attribute '$attributeName' is expected to be '$expectedAttributeValue', but is '$actualAttributeValue'." ) ; } } } } return $ this -> root ; }
Get root element of this component.
@return Element
Get root element of this component .