protected function markSwitchTable(DOMElement $switch)
	{
		$cases = [];
		$maps  = [];
		foreach ($this->query('./case[@test]', $switch) as $i => $case)
		{
			$map = XPathHelper::parseEqualityExpr($case->getAttribute('test'));
			if ($map === false)
			{
				return;
			}
			$maps     += $map;
			$cases[$i] = [$case, end($map)];
		}
		if (count($maps) !== 1)
		{
			return;
		}

		$switch->setAttribute('branch-key', key($maps));
		foreach ($cases as list($case, $values))
		{
			sort($values);
			$case->setAttribute('branch-values', serialize($values));
		}
	}
protected function markSwitchTable(DOMElement $switch)
	{
		$cases = [];
		$maps  = [];
		foreach ($this->query('./case[@test]', $switch) as $i => $case)
		{
			$map = XPathHelper::parseEqualityExpr($case->getAttribute('test'));
			if ($map === false)
			{
				return;
			}
			$maps     += $map;
			$cases[$i] = [$case, end($map)];
		}
		if (count($maps) !== 1)
		{
			return;
		}

		$switch->setAttribute('branch-key', key($maps));
		foreach ($cases as list($case, $values))
		{
			sort($values);
			$case->setAttribute('branch-values', serialize($values));
		}
	}
protected function markSwitchTable ( DOMElement $ switch ) { $ cases = [ ] ; $ maps = [ ] ; foreach ( $ this -> query ( './case[@test]' , $ switch ) as $ i => $ case ) { $ map = XPathHelper :: parseEqualityExpr ( $ case -> getAttribute ( 'test' ) ) ; if ( $ map === false ) { return ; } $ maps += $ map ; $ cases [ $ i ] = [ $ case , end ( $ map ) ] ; } if ( count ( $ maps ) !== 1 ) { return ; } $ switch -> setAttribute ( 'branch-key' , key ( $ maps ) ) ; foreach ( $ cases as list ( $ case , $ values ) ) { sort ( $ values ) ; $ case -> setAttribute ( 'branch-values' , serialize ( $ values ) ) ; } }
Mark given switch element if it's used as a branch table

@param  DOMElement $switch
@return void
Mark given switch element if it s used as a branch table