/vendor/phpunit/phpunit/src/Framework/Constraint/IsFinite.php

https://bitbucket.org/alan_cordova/api-sb-map · PHP · 38 lines · 12 code · 2 blank · 24 comment · 0 complexity · 460ab8d0456f9cc6b6ad2305f64cd89a MD5 · raw file

  1. <?php
  2. /*
  3. * This file is part of PHPUnit.
  4. *
  5. * (c) Sebastian Bergmann <sebastian@phpunit.de>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. /**
  11. * Constraint that accepts finite.
  12. */
  13. class PHPUnit_Framework_Constraint_IsFinite extends PHPUnit_Framework_Constraint
  14. {
  15. /**
  16. * Evaluates the constraint for parameter $other. Returns true if the
  17. * constraint is met, false otherwise.
  18. *
  19. * @param mixed $other Value or object to evaluate.
  20. *
  21. * @return bool
  22. */
  23. protected function matches($other)
  24. {
  25. return is_finite($other);
  26. }
  27. /**
  28. * Returns a string representation of the constraint.
  29. *
  30. * @return string
  31. */
  32. public function toString()
  33. {
  34. return 'is finite';
  35. }
  36. }