public function optimize(DOMDocument $ir)
	{
		$this->createXPath($ir);

		// Get a snapshot of current internal representation
		$xml = $ir->saveXML();

		// Set a maximum number of loops to ward against infinite loops
		$remainingLoops = 10;

		// From now on, keep looping until no further modifications are applied
		do
		{
			$old = $xml;
			$this->optimizeCloseTagElements($ir);
			$xml = $ir->saveXML();
		}
		while (--$remainingLoops > 0 && $xml !== $old);

		$this->removeCloseTagSiblings($ir);
		$this->removeContentFromVoidElements($ir);
		$this->mergeConsecutiveLiteralOutputElements($ir);
		$this->removeEmptyDefaultCases($ir);
	}
public function optimize(DOMDocument $ir)
	{
		$this->createXPath($ir);

		// Get a snapshot of current internal representation
		$xml = $ir->saveXML();

		// Set a maximum number of loops to ward against infinite loops
		$remainingLoops = 10;

		// From now on, keep looping until no further modifications are applied
		do
		{
			$old = $xml;
			$this->optimizeCloseTagElements($ir);
			$xml = $ir->saveXML();
		}
		while (--$remainingLoops > 0 && $xml !== $old);

		$this->removeCloseTagSiblings($ir);
		$this->removeContentFromVoidElements($ir);
		$this->mergeConsecutiveLiteralOutputElements($ir);
		$this->removeEmptyDefaultCases($ir);
	}
public function optimize ( DOMDocument $ ir ) { $ this -> createXPath ( $ ir ) ; // Get a snapshot of current internal representation $ xml = $ ir -> saveXML ( ) ; // Set a maximum number of loops to ward against infinite loops $ remainingLoops = 10 ; // From now on, keep looping until no further modifications are applied do { $ old = $ xml ; $ this -> optimizeCloseTagElements ( $ ir ) ; $ xml = $ ir -> saveXML ( ) ; } while ( -- $ remainingLoops > 0 && $ xml !== $ old ) ; $ this -> removeCloseTagSiblings ( $ ir ) ; $ this -> removeContentFromVoidElements ( $ ir ) ; $ this -> mergeConsecutiveLiteralOutputElements ( $ ir ) ; $ this -> removeEmptyDefaultCases ( $ ir ) ; }
Optimize an IR

@param  DOMDocument $ir
@return void
Optimize an IR