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