PageRenderTime 878ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 1ms

/plugin/PBAPI/PBAPI/Methods.php

https://bitbucket.org/chamilo/chamilo-ext-repo-photobucket-dev/
PHP | 70 lines | 21 code | 7 blank | 42 comment | 0 complexity | c32a41feaf8330860ea3b8a18ce2014c MD5 | raw file
  1. <?php
  2. /**
  3. * Photobucket API
  4. * Fluent interface for PHP5
  5. * Methods parent class
  6. *
  7. * @author jhart
  8. * @package PBAPI
  9. *
  10. * @copyright Copyright (c) 2008, Photobucket, Inc.
  11. * @license http://www.opensource.org/licenses/mit-license.php The MIT License
  12. */
  13. /**
  14. * Methods parent class
  15. *
  16. * @package PBAPI
  17. */
  18. abstract class PBAPI_Methods
  19. {
  20. /**
  21. * 'core' PBAPI object
  22. *
  23. * @var PBAPI
  24. */
  25. protected $core;
  26. /**
  27. * Class constructor
  28. *
  29. * @param PBAPI $core set the main class
  30. */
  31. public function __construct($core)
  32. {
  33. $this->core = $core;
  34. }
  35. /**
  36. * Reset the methods objects
  37. *
  38. */
  39. public function _reset()
  40. {
  41. $this->_load('base');
  42. }
  43. /**
  44. * Default forwarder that says method not found
  45. *
  46. * @param string $name
  47. * @param array $params
  48. */
  49. public function __call($name, $params)
  50. {
  51. throw new PBAPI_Exception("Method $name not found", $this->core);
  52. }
  53. /**
  54. * Load a method class
  55. *
  56. * @param string $name Method class name (one of PBAPI/Methods/*)
  57. * @return PBAPI_Methods
  58. */
  59. public function _load($name)
  60. {
  61. return $this->core->_loadMethodClass($name);
  62. }
  63. }