Visitor Class Reference

Detailed Description

Visitor is used to extend an object's functionality by not extending its interface.

Classes to use with the Visitor must implement the acceptVisitor() method. Visitor implements the 'Visitor Pattern'. It implements the 'Template Method Pattern' to allow subclasses to do any Pre- and Post Visit operations (doPreVisit() and doPostVisit() methods). The abstract base class Visitor defines the interface for all specialized Visitor classes.

Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 26 of file Visitor.php.

+ Inheritance diagram for Visitor:

Public Member Functions

 startIterator (NodeIterator $iterator)
 
 startArray ($array)
 
 visit ($obj)
 
 doPreVisit ()
 
 doPostVisit ()
 

Member Function Documentation

◆ startIterator()

startIterator ( NodeIterator  $iterator)

Start the visiting process by iterating over all objects using the given NodeIterator.

The visit() method is called by every visited object.

Parameters
$iteratorNodeIterator to use (configured with the start object).

Definition at line 34 of file Visitor.php.

◆ startArray()

startArray (   $array)

Start the visiting process by iterating over all elements of a given array.

The visit() method is called by every visited object.

Parameters
$arrayAn array holding references to the objects to visit.

Definition at line 47 of file Visitor.php.

◆ visit()

visit (   $obj)
abstract

Visit the current object in iteration.

Subclasses of Visitor override this method to implement the specialized functionality.

Parameters
$objPersistentObject instance

Reimplemented in OutputVisitor, and LayoutVisitor.

◆ doPreVisit()

doPreVisit ( )

Subclasses may override this method to do any operations before the visiting process here.

Reimplemented in OutputVisitor.

Definition at line 66 of file Visitor.php.

◆ doPostVisit()

doPostVisit ( )

Subclasses may override this method to do any operations after the visiting process here.

Reimplemented in OutputVisitor.

Definition at line 71 of file Visitor.php.