Skip to content

Commit

Permalink
allow numeric in matchTime()
Browse files Browse the repository at this point in the history
  • Loading branch information
heartsentwined committed Sep 19, 2012
1 parent 4f6d155 commit 6a083ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -11,11 +11,11 @@ Parse cron expressions and match them against time.
```json
{
"require": {
"heartsentwined/cron-expr-parser": "dev-master"
"heartsentwined/cron-expr-parser": "1.*"
}
}
```

# Usage

todo
Parse in a Cron expression and a time, and determine if the given time falls within the given cron expression
8 changes: 4 additions & 4 deletions src/Heartsentwined/CronExprParser/Parser.php
Expand Up @@ -9,7 +9,9 @@ class Parser
/**
* determine whether a given time falls within the given cron expr
*
* @param string $frequency
* @param string|numeric $time
* timestamp or strtotime()-compatible string
* @param string $expr
* any valid cron expression, in addition supporting:
* range: '0-5'
* range + interval: '10-59/5'
Expand All @@ -27,14 +29,12 @@ class Parser
* every day between day 2-10 and day 15-25
* every 2nd month between January-June
* Monday-Friday
* @param string|int $time
* timestamp or strtotime()-compatible string
* @throws Exception\InvalidArgumentException on invalid cron expression
* @return bool
*/
public static function matchTime($time, $expr)
{
ArgValidator::assert($time, array('string', 'int'));
ArgValidator::assert($time, array('string', 'numeric'));
ArgValidator::assert($expr, 'string');

$cronExpr = preg_split('/\s+/', $expr, null, PREG_SPLIT_NO_EMPTY);
Expand Down

0 comments on commit 6a083ed

Please sign in to comment.