You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

41 lines
1.1 KiB

  1. <?php
  2. namespace Cron;
  3. use DateTime;
  4. /**
  5. * CRON field interface
  6. */
  7. interface FieldInterface
  8. {
  9. /**
  10. * Check if the respective value of a DateTime field satisfies a CRON exp
  11. *
  12. * @param DateTime $date DateTime object to check
  13. * @param string $value CRON expression to test against
  14. *
  15. * @return bool Returns TRUE if satisfied, FALSE otherwise
  16. */
  17. public function isSatisfiedBy(DateTime $date, $value);
  18. /**
  19. * When a CRON expression is not satisfied, this method is used to increment
  20. * or decrement a DateTime object by the unit of the cron field
  21. *
  22. * @param DateTime $date DateTime object to change
  23. * @param bool $invert (optional) Set to TRUE to decrement
  24. *
  25. * @return FieldInterface
  26. */
  27. public function increment(DateTime $date, $invert = false);
  28. /**
  29. * Validates a CRON expression for a given field
  30. *
  31. * @param string $value CRON expression value to validate
  32. *
  33. * @return bool Returns TRUE if valid, FALSE otherwise
  34. */
  35. public function validate($value);
  36. }