| 1 |
lars |
1 |
<?php
|
|
|
2 |
/* SVN FILE: $Id: overloadable_php5.php 7945 2008-12-19 02:16:01Z gwoo $ */
|
|
|
3 |
/**
|
|
|
4 |
* Overload abstraction interface. Merges differences between PHP4 and 5.
|
|
|
5 |
*
|
|
|
6 |
* PHP versions 4 and 5
|
|
|
7 |
*
|
|
|
8 |
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
|
|
|
9 |
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
|
|
10 |
*
|
|
|
11 |
* Licensed under The MIT License
|
|
|
12 |
* Redistributions of files must retain the above copyright notice.
|
|
|
13 |
*
|
|
|
14 |
* @filesource
|
|
|
15 |
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
|
|
16 |
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
|
|
17 |
* @package cake
|
|
|
18 |
* @subpackage cake.cake.libs
|
|
|
19 |
* @since CakePHP(tm) v 1.2
|
|
|
20 |
* @version $Revision: 7945 $
|
|
|
21 |
* @modifiedby $LastChangedBy: gwoo $
|
|
|
22 |
* @lastmodified $Date: 2008-12-18 18:16:01 -0800 (Thu, 18 Dec 2008) $
|
|
|
23 |
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
|
|
24 |
*/
|
|
|
25 |
/**
|
|
|
26 |
* Overloadable class selector
|
|
|
27 |
*
|
|
|
28 |
* Load the interface class based on the version of PHP.
|
|
|
29 |
*
|
|
|
30 |
* @package cake
|
|
|
31 |
* @subpackage cake.cake.libs
|
|
|
32 |
*/
|
|
|
33 |
class Overloadable extends Object {
|
|
|
34 |
/**
|
|
|
35 |
* Overload implementation. No need for implementation in PHP5.
|
|
|
36 |
*
|
|
|
37 |
* @access public
|
|
|
38 |
*/
|
|
|
39 |
function overload() { }
|
|
|
40 |
/**
|
|
|
41 |
* Magic method handler.
|
|
|
42 |
*
|
|
|
43 |
* @param string $method Method name
|
|
|
44 |
* @param array $params Parameters to send to method
|
|
|
45 |
* @return mixed Return value from method
|
|
|
46 |
* @access private
|
|
|
47 |
*/
|
|
|
48 |
function __call($method, $params) {
|
|
|
49 |
if (!method_exists($this, 'call__')) {
|
|
|
50 |
trigger_error(sprintf(__('Magic method handler call__ not defined in %s', true), get_class($this)), E_USER_ERROR);
|
|
|
51 |
}
|
|
|
52 |
return $this->call__($method, $params);
|
|
|
53 |
}
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
/**
|
|
|
57 |
* Overloadable2 class selector
|
|
|
58 |
*
|
|
|
59 |
* Load the interface class based on the version of PHP.
|
|
|
60 |
*
|
|
|
61 |
* @package cake
|
|
|
62 |
*/
|
|
|
63 |
class Overloadable2 extends Object {
|
|
|
64 |
/**
|
|
|
65 |
* Overload implementation. No need for implementation in PHP5.
|
|
|
66 |
*
|
|
|
67 |
* @access public
|
|
|
68 |
*/
|
|
|
69 |
function overload() { }
|
|
|
70 |
/**
|
|
|
71 |
* Magic method handler.
|
|
|
72 |
*
|
|
|
73 |
* @param string $method Method name
|
|
|
74 |
* @param array $params Parameters to send to method
|
|
|
75 |
* @return mixed Return value from method
|
|
|
76 |
* @access private
|
|
|
77 |
*/
|
|
|
78 |
function __call($method, $params) {
|
|
|
79 |
if (!method_exists($this, 'call__')) {
|
|
|
80 |
trigger_error(sprintf(__('Magic method handler call__ not defined in %s', true), get_class($this)), E_USER_ERROR);
|
|
|
81 |
}
|
|
|
82 |
return $this->call__($method, $params);
|
|
|
83 |
}
|
|
|
84 |
/**
|
|
|
85 |
* Getter.
|
|
|
86 |
*
|
|
|
87 |
* @param mixed $name What to get
|
|
|
88 |
* @param mixed $value Where to store returned value
|
|
|
89 |
* @return boolean Success
|
|
|
90 |
* @access private
|
|
|
91 |
*/
|
|
|
92 |
function __get($name) {
|
|
|
93 |
return $this->get__($name);
|
|
|
94 |
}
|
|
|
95 |
/**
|
|
|
96 |
* Setter.
|
|
|
97 |
*
|
|
|
98 |
* @param mixed $name What to set
|
|
|
99 |
* @param mixed $value Value to set
|
|
|
100 |
* @return boolean Success
|
|
|
101 |
* @access private
|
|
|
102 |
*/
|
|
|
103 |
function __set($name, $value) {
|
|
|
104 |
return $this->set__($name, $value);
|
|
|
105 |
}
|
|
|
106 |
}
|
|
|
107 |
?>
|