From 1369cfd33e26ebc2a61e5ab8093b5f8882bb4a5f Mon Sep 17 00:00:00 2001 From: Holger Woltersdorf Date: Mon, 29 Aug 2016 22:57:25 +0200 Subject: [PATCH] Added README and CHANGELOG entries --- CHANGELOG.md | 5 ++++ README.md | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ae5280..3a1ab73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,3 +3,8 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a CHANGELOG](http://keepachangelog.com). +## 1.0.0 - 2016-08-29 + +### Added + +* Interval validation in boolean and/or guarding manner diff --git a/README.md b/README.md index d8200b1..a1597ae 100644 --- a/README.md +++ b/README.md @@ -9,3 +9,67 @@ A validator for crontab values +## Features + +* Validation of crontab interval strings like 6,21,36,51 7-23/1 * FEB-NOV/2 *. + +## Requirements + +* PHP >= 7.0.0 + +## Usage + +### Boolean validation + +```php +isIntervalValid('6,21,36,51 7-23/1 * FEB-NOV/2 *') ) +{ + echo "Interval is valid."; +} +else +{ + echo "Interval is invalid."; +} +``` + +### Guarding + +```php + All fine, execution continues + $validator->guardIntervalIsValid('6,21,36,51 7-23/1 * FEB-NOV/2 *'); + + # => This will raise an InvalidCrontabInterval exception + $validator->guardIntervalIsValid('this is not a valid interval'); +} +catch (InvalidCrontabInterval $e) +{ + echo $e->getMessage() . ': "' . $e->getCrontabInterval() . '"'; +} +``` + +**Prints:** + + Invalid crontab interval: "this is not a valid interval" + + +--- + +Feedback and contributions welcome!