| @@ 8-29 (lines=22) @@ | ||
| 5 | /** |
|
| 6 | * @author JM Leroux <[email protected]> |
|
| 7 | */ |
|
| 8 | class CronDayOfMonthFormatValidator extends AbstractCronTimeFormatValidator |
|
| 9 | { |
|
| 10 | /** |
|
| 11 | * @inheritdoc |
|
| 12 | */ |
|
| 13 | public function validateTimeEntry($item) |
|
| 14 | { |
|
| 15 | if ('' === trim($item)) { |
|
| 16 | return false; |
|
| 17 | } |
|
| 18 | ||
| 19 | if (is_numeric($item) && ($item < 1 || $item > 31)) { |
|
| 20 | return false; |
|
| 21 | } |
|
| 22 | ||
| 23 | if (!is_numeric($item) && !preg_match('#(^\*$)|(^\*/[0-9]+$)#', $item)) { |
|
| 24 | return false; |
|
| 25 | } |
|
| 26 | ||
| 27 | return true; |
|
| 28 | } |
|
| 29 | } |
|
| 30 | ||
| @@ 8-29 (lines=22) @@ | ||
| 5 | /** |
|
| 6 | * @author JM Leroux <[email protected]> |
|
| 7 | */ |
|
| 8 | class CronDayOfWeekFormatValidator extends AbstractCronTimeFormatValidator |
|
| 9 | { |
|
| 10 | /** |
|
| 11 | * @inheritdoc |
|
| 12 | */ |
|
| 13 | public function validateTimeEntry($item) |
|
| 14 | { |
|
| 15 | if ('' === trim($item)) { |
|
| 16 | return false; |
|
| 17 | } |
|
| 18 | ||
| 19 | if (is_numeric($item) && ($item < 0 || $item > 7)) { |
|
| 20 | return false; |
|
| 21 | } |
|
| 22 | ||
| 23 | if (!is_numeric($item) && !preg_match('#(^\*$)|(^\*/[0-9]+$)#', $item)) { |
|
| 24 | return false; |
|
| 25 | } |
|
| 26 | ||
| 27 | return true; |
|
| 28 | } |
|
| 29 | } |
|
| 30 | ||
| @@ 8-29 (lines=22) @@ | ||
| 5 | /** |
|
| 6 | * @author JM Leroux <[email protected]> |
|
| 7 | */ |
|
| 8 | class CronHourFormatValidator extends AbstractCronTimeFormatValidator |
|
| 9 | { |
|
| 10 | /** |
|
| 11 | * @inheritdoc |
|
| 12 | */ |
|
| 13 | public function validateTimeEntry($item) |
|
| 14 | { |
|
| 15 | if ('' === trim($item)) { |
|
| 16 | return false; |
|
| 17 | } |
|
| 18 | ||
| 19 | if (is_numeric($item) && ($item < 0 || $item > 23)) { |
|
| 20 | return false; |
|
| 21 | } |
|
| 22 | ||
| 23 | if (!is_numeric($item) && !preg_match('#(^\*$)|(^\*/[0-9]+$)#', $item)) { |
|
| 24 | return false; |
|
| 25 | } |
|
| 26 | ||
| 27 | return true; |
|
| 28 | } |
|
| 29 | } |
|
| 30 | ||
| @@ 8-29 (lines=22) @@ | ||
| 5 | /** |
|
| 6 | * @author JM Leroux <[email protected]> |
|
| 7 | */ |
|
| 8 | class CronMinuteFormatValidator extends AbstractCronTimeFormatValidator |
|
| 9 | { |
|
| 10 | /** |
|
| 11 | * @inheritdoc |
|
| 12 | */ |
|
| 13 | public function validateTimeEntry($item) |
|
| 14 | { |
|
| 15 | if ('' === trim($item)) { |
|
| 16 | return false; |
|
| 17 | } |
|
| 18 | ||
| 19 | if (is_numeric($item) && ($item < 0 || $item > 59)) { |
|
| 20 | return false; |
|
| 21 | } |
|
| 22 | ||
| 23 | if (!is_numeric($item) && !preg_match('#(^\*$)|(^\*/[0-9]+$)#', $item)) { |
|
| 24 | return false; |
|
| 25 | } |
|
| 26 | ||
| 27 | return true; |
|
| 28 | } |
|
| 29 | } |
|
| 30 | ||
| @@ 8-29 (lines=22) @@ | ||
| 5 | /** |
|
| 6 | * @author JM Leroux <[email protected]> |
|
| 7 | */ |
|
| 8 | class CronMonthFormatValidator extends AbstractCronTimeFormatValidator |
|
| 9 | { |
|
| 10 | /** |
|
| 11 | * @inheritdoc |
|
| 12 | */ |
|
| 13 | public function validateTimeEntry($item) |
|
| 14 | { |
|
| 15 | if ('' === trim($item)) { |
|
| 16 | return false; |
|
| 17 | } |
|
| 18 | ||
| 19 | if (is_numeric($item) && ($item < 1 || $item > 12)) { |
|
| 20 | return false; |
|
| 21 | } |
|
| 22 | ||
| 23 | if (!is_numeric($item) && !preg_match('#(^\*$)|(^\*/[0-9]+$)#', $item)) { |
|
| 24 | return false; |
|
| 25 | } |
|
| 26 | ||
| 27 | return true; |
|
| 28 | } |
|
| 29 | } |
|
| 30 | ||