MaxAge.php 538 B

123456789101112131415161718192021222324252627
  1. <?php
  2. /*
  3. * Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
  4. * SPDX-License-Identifier: MIT
  5. */
  6. declare(strict_types=1);
  7. namespace Respect\Validation\Rules;
  8. /**
  9. * Validates a maximum age for a given date.
  10. *
  11. * @author Emmerson Siqueira <emmersonsiqueira@gmail.com>
  12. * @author Henrique Moody <henriquemoody@gmail.com>
  13. */
  14. final class MaxAge extends AbstractAge
  15. {
  16. /**
  17. * {@inheritDoc}
  18. */
  19. protected function compare(int $baseDate, int $givenDate): bool
  20. {
  21. return $baseDate <= $givenDate;
  22. }
  23. }