/library/Rules/Max.php

http://github.com/Respect/Validation · PHP · 31 lines · 10 code · 4 blank · 17 comment · 0 complexity · e0d8ccfa0cc793ea2f37922184b89ea2 MD5 · raw file

  1. <?php
  2. /*
  3. * This file is part of Respect/Validation.
  4. *
  5. * (c) Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
  6. *
  7. * For the full copyright and license information, please view the LICENSE file
  8. * that was distributed with this source code.
  9. */
  10. declare(strict_types=1);
  11. namespace Respect\Validation\Rules;
  12. /**
  13. * Validates whether the input is less than or equal to a value.
  14. *
  15. * @author Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
  16. * @author Henrique Moody <henriquemoody@gmail.com>
  17. */
  18. final class Max extends AbstractComparison
  19. {
  20. /**
  21. * {@inheritDoc}
  22. */
  23. protected function compare($left, $right): bool
  24. {
  25. return $left <= $right;
  26. }
  27. }