MediaSearch_Interface
[ class tree: MediaSearch_Interface ] [ index: MediaSearch_Interface ] [ all elements ]

Class: MediaSearch_Interface_Visitor

Source Location: /MediaSearch/Interface/Visitor.php

Interface Overview


A visitor is an object which can visit other objects which implements MediaSearch_Interface_Visitable. See visitor pattern from GoF for more Information.


Author(s):

Copyright:

  • Copyright (c) 2009 Sven Strittmatter

Methods



Class Details

[line 30]
A visitor is an object which can visit other objects which implements MediaSearch_Interface_Visitable. See visitor pattern from GoF for more Information.



Tags:

copyright:  Copyright (c) 2009 Sven Strittmatter


[ Top ]


Class Methods


method visit [line 59]

void visit( MediaSearch_Interface_Visitable $visitingSubject)

If a visitable object accepts the visior it should call this method with $this, or with all other visitable properties which are in interest for the visitor.

In this visit method you can ask the visiting subject(s) for the information your visitor is interested in.

Example:

  1.  class MyTreeVisitor implements MediaSearch_Interface_Visitor{
  2.       private $countNodes 0;
  3.       private $countLeafes 0;
  4.  
  5.       public function visit(MediaSearch_Interface_Visitable $visitingSubject{
  6.           if ($visitingSubject instanceof MyTreeObject{
  7.               if ($visitingSubject->isNode()) {
  8.                   $this->countNodes++;
  9.               else if ($visitingSubject->isLeaf()) {
  10.                   $this->countLeafes++;
  11.               }
  12.           }
  13.       }
  14.  }




Tags:

access:  public


Parameters:

MediaSearch_Interface_Visitable   $visitingSubject  

[ Top ]


Documentation generated on Mon, 17 Aug 2009 14:54:28 +0200 by phpDocumentor 1.4.2