mtdowling / cron-expression

CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due
http://mtdowling.com/blog/2012/06/03/cron-expressions-in-php/
MIT License
4.9k stars 335 forks source link

Allow multiple spaces and even tabs to be schedula separators #27

Closed Damu112 closed 11 years ago

Damu112 commented 11 years ago

Hi,

first of all, thanks for this great tool! :-) I'm sending you this pull request in order to fix something I'd call a bug: Crontab schedules allow multiple spaces and also tabs to be separators of single schedule parts.

However, as cron-expression split by a single space, this syntax was not supported.

I've fixed this using a simple regex.

Feel free to accept my pull request in case you're agreeing with me that cron-expression should support this feature.

Greetings, Daniel

Damu112 commented 11 years ago

Yes, it could, but I think its more readable this way. Using a for here is some kind of magic that one might not understand as quickly as the 6 method calls with the constants.

Damu112 commented 11 years ago

Added another commit to fix the new test, I forgot to change something there. It's now complete, tests are still passing.

mtdowling commented 11 years ago

Thanks for the PR! This looks great.