Skip to content

Commit

Permalink
Fixed period possible value specification [fixes #38]
Browse files Browse the repository at this point in the history
  • Loading branch information
stekycz committed Mar 5, 2015
1 parent 2314766 commit 5108262
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cronner/Tasks/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static function parsePeriod($annotation)
$annotation = Strings::trim($annotation);
if (Strings::length($annotation)) {
if (strtotime('+ ' . $annotation) === FALSE) {
throw new InvalidParameterException("Given period parameter '" . $annotation . "' must be valid for strtotime().");
throw new InvalidParameterException("Given period parameter '" . $annotation . "' must be valid for strtotime() with '+' sign as its prefix (added by Cronner automatically).");
}
$period = $annotation;
}
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ every time when Cronner runs.

Not required but recommended annotation which specifies period of task execution.
The period is minimal time between two executions of the task. It's value can be
anything what is acceptable for `strtotime()` function.
anything what is acceptable for `strtotime()` function. The only restriction is usability
with "+" sign before which is added by Cronner automatically. So `first day of this month`
ia not acceptable however `1 month` is acceptable.

**Attention!** The value of this annotation must not contain any sign (+ or -).

Expand Down

0 comments on commit 5108262

Please sign in to comment.