AbstractMock.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * The interface that all hash implementations must implement
  4. *
  5. * PHP version 5.3
  6. *
  7. * @category PHPPasswordLib
  8. * @package Hash
  9. * @author Anthony Ferrara <ircmaxell@ircmaxell.com>
  10. * @copyright 2011 The Authors
  11. * @license http://opensource.org/licenses/bsd-license.php New BSD License
  12. * @license http://www.gnu.org/licenses/lgpl-2.1.html LGPL v 2.1
  13. */
  14. namespace PasswordLibTest\Mocks;
  15. /**
  16. * The interface that all hash implementations must implement
  17. *
  18. * @category PHPPasswordLib
  19. * @package Hash
  20. * @author Anthony Ferrara <ircmaxell@ircmaxell.com>
  21. */
  22. class AbstractMock {
  23. protected $callbacks = array();
  24. public static function init() {}
  25. public function __construct(array $callbacks = array()) {
  26. $this->callbacks = $callbacks;
  27. }
  28. public function __call($name, array $args = array()) {
  29. if (isset($this->callbacks[$name])) {
  30. return call_user_func_array($this->callbacks[$name], $args);
  31. }
  32. return null;
  33. }
  34. }