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