overloadable_php4.php

Go to the documentation of this file.
00001 <?php
00002 /* SVN FILE: $Id: overloadable_php4.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  * Constructor.
00036  *
00037  * @access private
00038  */
00039     function __construct() {
00040         $this->overload();
00041         parent::__construct();
00042     }
00043 /**
00044  * Overload implementation.
00045  *
00046  * @access public
00047  */
00048     function overload() {
00049         if (function_exists('overload')) {
00050             if (func_num_args() > 0) {
00051                 foreach (func_get_args() as $class) {
00052                     if (is_object($class)) {
00053                         overload(get_class($class));
00054                     } elseif (is_string($class)) {
00055                         overload($class);
00056                     }
00057                 }
00058             } else {
00059                 overload(get_class($this));
00060             }
00061         }
00062     }
00063 
00064 /**
00065  * Magic method handler.
00066  *
00067  * @param string $method Method name
00068  * @param array $params Parameters to send to method
00069  * @param mixed $return Where to store return value from method
00070  * @return boolean Success
00071  * @access private
00072  */
00073     function __call($method, $params, &$return) {
00074         if (!method_exists($this, 'call__')) {
00075             trigger_error(sprintf(__('Magic method handler call__ not defined in %s', true), get_class($this)), E_USER_ERROR);
00076         }
00077         $return = $this->call__($method, $params);
00078         return true;
00079     }
00080 }
00081 Overloadable::overload('Overloadable');
00082 
00083 /**
00084  * Overloadable2 class selector
00085  *
00086  * Load the interface class based on the version of PHP.
00087  *
00088  * @package       cake
00089  * @subpackage    cake.cake.libs
00090  */
00091 class Overloadable2 extends Object {
00092 /**
00093  * Constructor
00094  *
00095  * @access private
00096  */
00097     function __construct() {
00098         $this->overload();
00099         parent::__construct();
00100     }
00101 /**
00102  * Overload implementation.
00103  *
00104  * @access public
00105  */
00106     function overload() {
00107         if (function_exists('overload')) {
00108             if (func_num_args() > 0) {
00109                 foreach (func_get_args() as $class) {
00110                     if (is_object($class)) {
00111                         overload(get_class($class));
00112                     } elseif (is_string($class)) {
00113                         overload($class);
00114                     }
00115                 }
00116             } else {
00117                 overload(get_class($this));
00118             }
00119         }
00120     }
00121 /**
00122  * Magic method handler.
00123  *
00124  * @param string $method Method name
00125  * @param array $params Parameters to send to method
00126  * @param mixed $return Where to store return value from method
00127  * @return boolean Success
00128  * @access private
00129  */
00130     function __call($method, $params, &$return) {
00131         if (!method_exists($this, 'call__')) {
00132             trigger_error(sprintf(__('Magic method handler call__ not defined in %s', true), get_class($this)), E_USER_ERROR);
00133         }
00134         $return = $this->call__($method, $params);
00135         return true;
00136     }
00137 /**
00138  * Getter.
00139  *
00140  * @param mixed $name What to get
00141  * @param mixed $value Where to store returned value
00142  * @return boolean Success
00143  * @access private
00144  */
00145     function __get($name, &$value) {
00146         $value = $this->get__($name);
00147         return true;
00148     }
00149 /**
00150  * Setter.
00151  *
00152  * @param mixed $name What to set
00153  * @param mixed $value Value to set
00154  * @return boolean Success
00155  * @access private
00156  */
00157     function __set($name, $value) {
00158         $this->set__($name, $value);
00159         return true;
00160     }
00161 }
00162 Overloadable::overload('Overloadable2');
00163 
00164 ?>

Generated on Sun Nov 22 00:30:54 2009 for CakePHP 1.2.x.x (v1.2.4.8284) by doxygen 1.4.7