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

Class: MediaSearch_Interface_Visitable

Source Location: /MediaSearch/Interface/Visitable.php

Interface Overview


Objects implementing this interface are visitable by any objects implementing the MediaSearch_Interface_Visitor. This interface is part of the visitor pattern implementation in MediaSearch. See GoF for more Information.


Author(s):

Copyright:

  • Copyright (c) 2009 Sven Strittmatter

Methods



Class Details

[line 31]
Objects implementing this interface are visitable by any objects implementing the MediaSearch_Interface_Visitor. This interface is part of the visitor pattern implementation in MediaSearch. See GoF for more Information.



Tags:

copyright:  Copyright (c) 2009 Sven Strittmatter


[ Top ]


Class Methods


method acceptVisitor [line 60]

void acceptVisitor( MediaSearch_Interface_Visitor $visitor)

Acceptps any visitor implementing MediaSearch_Interface_Visitor.

Use this method on your visitable objects to accept the visitor object and then visit it. For this purpose every visitor implementing MediaSearch_Interface_Visitor provides the method visit(). You pass the visitable object to the visitors visit method, so the visitor can collect some data. After that the visited object can give the visitor next to ist child objects to visit them, if they implement MediaSearch_Interface_Visitable, too.

Example:

  1.  class MyVisitable implements MediaSearch_Interface_Visitable {
  2.       private $childs;
  3.       //...
  4.       public function acceptVisitor(MediaSearch_Interface_Visitor $visitor{
  5.           $visitor->visit($this);
  6.  
  7.           foreach ($this->childs as $child{
  8.               $child->acceptVisitor($visitor);
  9.           }
  10.       }
  11.  }




Tags:

access:  public


Parameters:


[ Top ]


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