PageRenderTime 42ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/cake/libs/overloadable_php5.php

https://github.com/MrRio/wildflower
PHP | 107 lines | 26 code | 1 blank | 80 comment | 2 complexity | 73e159b4746e5572cbf7ac600b66ce60 MD5 | raw file
Possible License(s): LGPL-2.1
  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. * Overloadable2 class selector
  57. *
  58. * Load the interface class based on the version of PHP.
  59. *
  60. * @package cake
  61. */
  62. class Overloadable2 extends Object {
  63. /**
  64. * Overload implementation. No need for implementation in PHP5.
  65. *
  66. * @access public
  67. */
  68. function overload() { }
  69. /**
  70. * Magic method handler.
  71. *
  72. * @param string $method Method name
  73. * @param array $params Parameters to send to method
  74. * @return mixed Return value from method
  75. * @access private
  76. */
  77. function __call($method, $params) {
  78. if (!method_exists($this, 'call__')) {
  79. trigger_error(sprintf(__('Magic method handler call__ not defined in %s', true), get_class($this)), E_USER_ERROR);
  80. }
  81. return $this->call__($method, $params);
  82. }
  83. /**
  84. * Getter.
  85. *
  86. * @param mixed $name What to get
  87. * @param mixed $value Where to store returned value
  88. * @return boolean Success
  89. * @access private
  90. */
  91. function __get($name) {
  92. return $this->get__($name);
  93. }
  94. /**
  95. * Setter.
  96. *
  97. * @param mixed $name What to set
  98. * @param mixed $value Value to set
  99. * @return boolean Success
  100. * @access private
  101. */
  102. function __set($name, $value) {
  103. return $this->set__($name, $value);
  104. }
  105. }
  106. ?>