<?php


/**
 *  Generic data object, should be extended by decorators
 *  @public
 */

class Record    {

    
/**
     *  array of data
     *  @private
     */
    
var $data = array();

    
/**
     *  Constructor
     *  @param  array array of row data
     *  @public
     **/
    
function Record($data null)  {
        if (
is_array($data) )   {
            
$this->data =   $data;
        }
    }

    
/**
     *  allows public access to internal data
     *  @param  string field
     *  @return mixed
     *  @public
     **/
    
    
function get($name) {
        if (isset(
$this->data[$name]) ) {
            return 
$this->data[$name];
        }
    }

    
/**
     *  internal check on existing methods / variables
     *  @param  string field
     *  @return boolean
     *  @private
     **/
    
    
function _isset($name)  {
        
$method =   'get_'.$name;
        if (
method_exists($this$method) or isset($this->data[$name]) )    {
            return 
true;
        }
    }

    
/**
     *  implements overloading for php4
     *  @param  string field
     *  @return mixed
     *  @public
     **/

    
function _get($name)  {
        
$method =   'get_'.$name;
        if (
method_exists($this$method) ) {
            return 
$this->$method();
        }
        if (isset(
$this->data[$name]) )    {
            return 
$this->data[$name];
        }
    } 

}

?>