00001 <?php 00002 /* SVN FILE: $Id: overloadable_php5.php 7847 2008-11-08 02:54:07Z renan.saddam $ */ 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. (http://www.cakefoundation.org) 00010 * 00011 * Licensed under The MIT License 00012 * Redistributions of files must retain the above copyright notice. 00013 * 00014 * @filesource 00015 * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) 00016 * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project 00017 * @package cake 00018 * @subpackage cake.cake.libs 00019 * @since CakePHP(tm) v 1.2 00020 * @version $Revision: 7847 $ 00021 * @modifiedby $LastChangedBy: renan.saddam $ 00022 * @lastmodified $Date: 2008-11-07 21:54:07 -0500 (Fri, 07 Nov 2008) $ 00023 * @license http://www.opensource.org/licenses/mit-license.php The MIT License 00024 */ 00025 /** 00026 * Overloadable class selector 00027 * 00028 * Load the interface class based on the version of PHP. 00029 * 00030 * @package cake 00031 * @subpackage cake.cake.libs 00032 */ 00033 class Overloadable extends Object { 00034 /** 00035 * Overload implementation. No need for implementation in PHP5. 00036 * 00037 * @access public 00038 */ 00039 function overload() { } 00040 /** 00041 * Magic method handler. 00042 * 00043 * @param string $method Method name 00044 * @param array $params Parameters to send to method 00045 * @return mixed Return value from method 00046 * @access private 00047 */ 00048 function __call($method, $params) { 00049 if (!method_exists($this, 'call__')) { 00050 trigger_error(sprintf(__('Magic method handler call__ not defined in %s', true), get_class($this)), E_USER_ERROR); 00051 } 00052 return $this->call__($method, $params); 00053 } 00054 } 00055 00056 /** 00057 * Overloadable2 class selector 00058 * 00059 * Load the interface class based on the version of PHP. 00060 * 00061 * @package cake 00062 */ 00063 class Overloadable2 extends Object { 00064 /** 00065 * Overload implementation. No need for implementation in PHP5. 00066 * 00067 * @access public 00068 */ 00069 function overload() { } 00070 /** 00071 * Magic method handler. 00072 * 00073 * @param string $method Method name 00074 * @param array $params Parameters to send to method 00075 * @return mixed Return value from method 00076 * @access private 00077 */ 00078 function __call($method, $params) { 00079 if (!method_exists($this, 'call__')) { 00080 trigger_error(sprintf(__('Magic method handler call__ not defined in %s', true), get_class($this)), E_USER_ERROR); 00081 } 00082 return $this->call__($method, $params); 00083 } 00084 /** 00085 * Getter. 00086 * 00087 * @param mixed $name What to get 00088 * @param mixed $value Where to store returned value 00089 * @return boolean Success 00090 * @access private 00091 */ 00092 function __get($name) { 00093 return $this->get__($name); 00094 } 00095 /** 00096 * Setter. 00097 * 00098 * @param mixed $name What to set 00099 * @param mixed $value Value to set 00100 * @return boolean Success 00101 * @access private 00102 */ 00103 function __set($name, $value) { 00104 return $this->set__($name, $value); 00105 } 00106 } 00107 ?>
1.4.7