PHP Classes
Icontem

File: _classes/EventHandler.class.php


  Search   All class groups All class groups   Latest entries Latest entries   Top 10 charts Top 10 charts   Newsletter Newsletter   Blog Blog   Forums Forums   Help FAQ Help FAQ  
  Login   Register  
Recommend this page to a friend! ReTweet ReTweet Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Marius Zadara  >  Logger  >  _classes/EventHandler.class.php  
File: _classes/EventHandler.class.php
Role: Class source
Content type: text/plain
Description: Event handler definition
Class: Logger
Filter and export data of application events
 

Contents

Class file image Download
<?php

/**
 * Abstract event handler.
 * This class sets the base of custom event handler.
 * These handlers are the event filters - if they accept the event, then will export it
 * 
 * 
 * @author Marius Zadara <marius@zadara.org>
 * @category org.zadara.marius.logger.classes
 * @copyright (C) 2008 Marius Zadara <marius@zadara.org>
 * @license GNU GPL
 * @package org.zadara.marius.logger
 * @abstract 
 * 
 */
abstract class EventHandler 
{
    
/**
     * Unique id of the event handler
     * @access protected
     */
    
protected $uniqueId;

    
/**
     * Event handler exporter.
     * On this exporter the export function will be called
     * if the event has been accepted.
     * 
     * @access protected
     */    
    
protected $eventExporter;
    
    
/**
     * Default constructor.
     * It sets the values of the fields.
     *
     * @access public
     * @param String $uniqueId Unique id of the handler
     * @return EventHandler
     */
    
public function EventHandler($uniqueId null)
    {
        
// set the event exporter 
        
$this->eventExporter null;
        
        
// and the unique id
        
$this->uniqueId is_null($uniqueId) ? uniqid() : $uniqueId;
    }
    
    
    
/**
     * Definition of the function that accepts the event.
     * The body of this function will be set into the custom event handlers
     * based on this class. In this function you can define any kind of rules
     * that will accept or reject the event
     * 
     * @access public
     * @param Event $event The new event to be accepted - or not
     * @return boolean
     */
    
public abstract function isEventAccepted($event);
    
    
    
/**
     * Handler unique id getter
     * @access public
     * @final 
     */
    
public final function getUniqueId()
    {        
        return 
$this->uniqueId;
    }
    
    
    
/**
     * Function to set the handler's exporter.
     * This object will be used to export the event.
     *
     * @param EventExporter $exporter The exporter object
     * @see EventExporter
     * @final 
     * @access public
     */
    
public final function setExporter($exporter)
    {
        if (
$this->eventExporter != null)
            return;
            
        
$this->eventExporter $exporter;
        
    }
    
    
    
/**
     * Function to get the event handler's exporter object.
     *
     * @access public
     * @final 
     * @return eventExporter
     */
    
public final function getExporter()
    {
        return 
$this->eventExporter;
    }
    
}


?>

 
  Advertise on this site Advertise on this site   Site map Site map   Statistics Statistics   Site tips Site tips   Privacy policy Privacy policy   Contact Contact  

For more information send a message to :
info at phpclasses dot org.
Copyright (c) Icontem 1999-2009 PHP Classes - PHP Class Scripts
  PHP Book Reviews - Reviews of books and other products