overloadable_php5.php

Go to the documentation of this file.
00001 <?php
00002 /* SVN FILE: $Id: overloadable__php5_8php-source.html 580 2008-07-01 14:45:49Z gwoo $ */
00003 /**
00004  * Overload abstraction interface.  Merges differences between PHP4 and 5.
00005  *
00006  * PHP versions 4 and 5
00007  *
00008  * CakePHP(tm) :  Rapid Development Framework <http://www.cakephp.org/>
00009  * Copyright 2005-2008, Cake Software Foundation, Inc.
00010  *                              1785 E. Sahara Avenue, Suite 490-204
00011  *                              Las Vegas, Nevada 89104
00012  *
00013  * Licensed under The MIT License
00014  * Redistributions of files must retain the above copyright notice.
00015  *
00016  * @filesource
00017  * @copyright       Copyright 2005-2008, Cake Software Foundation, Inc.
00018  * @link                http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
00019  * @package         cake
00020  * @subpackage      cake.cake.libs
00021  * @since           CakePHP(tm) v 1.2
00022  * @version         $Revision: 580 $
00023  * @modifiedby      $LastChangedBy: gwoo $
00024  * @lastmodified    $Date: 2008-07-01 09:45:49 -0500 (Tue, 01 Jul 2008) $
00025  * @license         http://www.opensource.org/licenses/mit-license.php The MIT License
00026  */
00027 /**
00028  * Overloadable class selector
00029  *
00030  * @package     cake
00031  * @subpackage  cake.cake.libs
00032  */
00033 
00034 /**
00035  * Load the interface class based on the version of PHP.
00036  *
00037  */
00038 class Overloadable extends Object {
00039 
00040 /**
00041  * Overload implementation. No need for implementation in PHP5.
00042  *
00043  * @access public
00044  */
00045     function overload() { }
00046 
00047 /**
00048  * Magic method handler.
00049  *
00050  * @param string $method Method name
00051  * @param array $params Parameters to send to method
00052  * @return mixed Return value from method
00053  * @access private
00054  */
00055     function __call($method, $params) {
00056         if (!method_exists($this, 'call__')) {
00057             trigger_error(sprintf(__('Magic method handler call__ not defined in %s', true), get_class($this)), E_USER_ERROR);
00058         }
00059         return $this->call__($method, $params);
00060     }
00061 }
00062 
00063 class Overloadable2 extends Object {
00064 
00065 /**
00066  * Overload implementation. No need for implementation in PHP5.
00067  *
00068  * @access public
00069  */
00070     function overload() { }
00071 
00072 /**
00073  * Magic method handler.
00074  *
00075  * @param string $method Method name
00076  * @param array $params Parameters to send to method
00077  * @return mixed Return value from method
00078  * @access private
00079  */
00080     function __call($method, $params) {
00081         if (!method_exists($this, 'call__')) {
00082             trigger_error(sprintf(__('Magic method handler call__ not defined in %s', true), get_class($this)), E_USER_ERROR);
00083         }
00084         return $this->call__($method, $params);
00085     }
00086 
00087 /**
00088  * Getter.
00089  *
00090  * @param mixed $name What to get
00091  * @param mixed $value Where to store returned value
00092  * @return boolean Success
00093  * @access private
00094  */
00095     function __get($name) {
00096         return $this->get__($name);
00097     }
00098 
00099 /**
00100  * Setter.
00101  *
00102  * @param mixed $name What to set
00103  * @param mixed $value Value to set
00104  * @return boolean Success
00105  * @access private
00106  */
00107     function __set($name, $value) {
00108         return $this->set__($name, $value);
00109     }
00110 }
00111 
00112 ?>