BaseMatcher.php 565 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace Hamcrest;
  3. /*
  4. Copyright (c) 2009 hamcrest.org
  5. */
  6. /**
  7. * BaseClass for all Matcher implementations.
  8. *
  9. * @see Hamcrest\Matcher
  10. */
  11. abstract class BaseMatcher implements Matcher
  12. {
  13. public function describeMismatch($item, Description $description)
  14. {
  15. $description->appendText('was ')->appendValue($item);
  16. }
  17. public function __toString()
  18. {
  19. return StringDescription::toString($this);
  20. }
  21. public function __invoke()
  22. {
  23. return call_user_func_array(array($this, 'matches'), func_get_args());
  24. }
  25. }