PageRenderTime 43ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/cake/libs/overloadable_php5.php

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