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

Source for file Event.php

Documentation is available at Event.php

  1. <?php
  2. /**
  3.  * MVClasses
  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.  * @category    MVClasses
  14.  * @package     Event
  15.  * @copyright   Copyright (c) 2007 Sven Strittmatter
  16.  */
  17.  
  18. /**
  19.  * Event
  20.  *
  21.  * Ein Event ist ein Ereignis-Objekt das in einem Kontext -
  22.  * meist ein Objekt - ausgeloesst wird.
  23.  *
  24.  * @category    MVClasses
  25.  * @package     Event
  26.  * @copyright     Copyright (c) 2007 Sven Strittmatter
  27.  * @author    "Sven Strittmatter" <ausserirdisch@sven-space.de>
  28.  * @version     1.0
  29.  * @link        http://www.sven-space.de/code/php/MVClasses
  30.  */
  31. class Event {
  32.     /**
  33.      * Der Name des Events.
  34.      *
  35.      * @access     private
  36.      * @var    string 
  37.      */
  38.     private $_name;
  39.     /**
  40.      * Der Kontext in dem der Event entstanden ist.
  41.      * Meistens die Referenz auf das Objekt, welches
  42.      * den Event ausgeloesst hat.
  43.      *
  44.      * @access     privat
  45.      * @var    object 
  46.      */
  47.     private $_context;
  48.     /**
  49.      * Zusaetzliche Information zu dem Event.
  50.      *
  51.      * @access     private
  52.      * @var    mixed 
  53.      */
  54.     private $_info;
  55.     /**
  56.      * Zeigt an ob ein Event gestoppt wurde
  57.      * und nicht mehr weiter verarbeitet werden soll.
  58.      *
  59.      * @access     private
  60.      * @var     boolean 
  61.      */
  62.     private $_cancelled;
  63.  
  64.     /**
  65.      * Konstruktor.
  66.      *
  67.      * @access    public
  68.      * @param    string    $name 
  69.      * @param    object    $context 
  70.      * @param    mixed    $info = null
  71.      */
  72.     public function __construct($name$context null$info null{
  73.         $this->_name $name;
  74.         $this->_context $context;
  75.         $this->_info $info;
  76.         $this->_cancelled false;
  77.     }
  78.  
  79.     /**
  80.      * Gibt den Namen des Events zurueck.
  81.      *
  82.      * @access     private
  83.      * @return    string 
  84.      */
  85.     public function getName({
  86.         return $this->_name;
  87.     }
  88.  
  89.     /**
  90.      * Liefert das Kontextobjekt zurueck.
  91.      *
  92.      * @access     private
  93.      * @return    object 
  94.      */
  95.     public function getContext({
  96.         return $this->_context;
  97.     }
  98.  
  99.     /**
  100.      * Gibt zusaetzliche Informationen des Events zurueck.
  101.      *
  102.      * @access     public
  103.      * @return    mixed 
  104.      */
  105.     public function getInfo({
  106.         return $this->_info;
  107.     }
  108.  
  109.     /**
  110.      * Gibt zurueck ob der Event gestopt wurde und
  111.      * nicht mehr weiter verarbeitet werden soll.
  112.      *
  113.      * @access    public
  114.      * @return    boolean 
  115.      */
  116.     public function isCancelled({
  117.         return $this->_cancelled;
  118.     }
  119.  
  120.     /**
  121.      * Stoppt ein Event, damit es nicht mehr weiterhin
  122.      * beachtet wird in einer Bearbeitungskette.
  123.      *
  124.      * @access    public
  125.      */
  126.     public function cancel({
  127.         $this->_cancelled true;
  128.     }
  129. }

Documentation generated on Sun, 02 Aug 2009 17:14:53 +0200 by phpDocumentor 1.4.2