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

Source for file Visitor.php

Documentation is available at Visitor.php

  1. <?php
  2. /**
  3.  * MediaSearch
  4.  *
  5.  * LICENSE
  6.  *
  7.  * "THE BEER-WARE LICENSE" (Revision 42):
  8.  * "Sven Strittmatter" <ausserirdisch@sven-space.de> wrote this file.
  9.  * As long as you retain this notice you can do whatever you want with
  10.  * this stuff. If we meet some day, and you think this stuff is worth it,
  11.  * you can buy me a beer in return.
  12.  *
  13.  * $Author$
  14.  * $Revision$
  15.  *
  16.  * @category    MediaSearch
  17.  * @package     MediaSearch_Interface
  18.  * @copyright   Copyright (c) 2009 Sven Strittmatter
  19.  */
  20.  
  21. /**
  22.  * A visitor is an object which can visit other objects which implements
  23.  * MediaSearch_Interface_Visitable. See visitor pattern from GoF for more
  24.  * Information.
  25.  *
  26.  * @category   MediaSearch
  27.  * @package    MediaSearch_Interface
  28.  * @copyright  Copyright (c) 2009 Sven Strittmatter
  29.  */
  30.     /**
  31.      * If a visitable object accepts the visior it should call
  32.      * this method with $this, or with all other visitable properties
  33.      * which are in interest for the visitor.
  34.      *
  35.      * In this visit method you can ask the visiting subject(s) for the
  36.      * information your visitor is interested in.
  37.      *
  38.      * Example:
  39.      * <code>
  40.      * class MyTreeVisitor implements MediaSearch_Interface_Visitor{
  41.      *      private $countNodes = 0;
  42.      *      private $countLeafes = 0;
  43.      *
  44.      *      public function visit(MediaSearch_Interface_Visitable $visitingSubject) {
  45.      *          if ($visitingSubject instanceof MyTreeObject) {
  46.      *              if ($visitingSubject->isNode()) {
  47.      *                  $this->countNodes++;
  48.      *              } else if ($visitingSubject->isLeaf()) {
  49.      *                  $this->countLeafes++;
  50.      *              }
  51.      *          }
  52.      *      }
  53.      * }
  54.      * </code>
  55.      *
  56.      * @param MediaSearch_Interface_Visitable $visitingSubject 
  57.      */
  58.     public function visit(MediaSearch_Interface_Visitable $visitingSubject);
  59. }

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