AbstractMock.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /*
  3. * The RandomLib library for securely generating random numbers and strings in PHP
  4. *
  5. * @author Anthony Ferrara <ircmaxell@ircmaxell.com>
  6. * @copyright 2011 The Authors
  7. * @license http://www.opensource.org/licenses/mit-license.html MIT License
  8. * @version Build @@version@@
  9. */
  10. /**
  11. * The interface that all hash implementations must implement
  12. *
  13. * PHP version 5.3
  14. *
  15. * @category PHPPasswordLib
  16. * @package Hash
  17. *
  18. * @author Anthony Ferrara <ircmaxell@ircmaxell.com>
  19. * @copyright 2011 The Authors
  20. * @license http://opensource.org/licenses/bsd-license.php New BSD License
  21. * @license http://www.gnu.org/licenses/lgpl-2.1.html LGPL v 2.1
  22. */
  23. namespace RandomLibtest\Mocks;
  24. /**
  25. * The interface that all hash implementations must implement
  26. *
  27. * @category PHPPasswordLib
  28. * @package Hash
  29. *
  30. * @author Anthony Ferrara <ircmaxell@ircmaxell.com>
  31. */
  32. class AbstractMock
  33. {
  34. protected $callbacks = array();
  35. public static function init()
  36. {
  37. }
  38. public function __construct(array $callbacks = array())
  39. {
  40. $this->callbacks = $callbacks;
  41. }
  42. public function __call($name, array $args = array())
  43. {
  44. if (isset($this->callbacks[$name])) {
  45. return call_user_func_array($this->callbacks[$name], $args);
  46. }
  47. return null;
  48. }
  49. }