From 09e50fb69f5728cdd9d5903348ef7dbf2787761d Mon Sep 17 00:00:00 2001 From: Andrejs Stepanovs Date: Tue, 6 Jan 2015 11:52:58 +0100 Subject: [PATCH] update README --- README.md | 58 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 740225c..6def8b6 100644 --- a/README.md +++ b/README.md @@ -12,31 +12,33 @@ Business Days Calculator "andrejsstepanovs/business-days-calculator": "dev-master", } -# Examples - - use \BusinessDays\Calculator; - - $holidays = [ - new \DateTime('2000-12-31'), - new \DateTime('2001-01-01') - ]; - - $freeDays = [ - new \DateTime('2000-12-28') - ]; - - $freeWeekDays = [ - Calculator::SATURDAY, - Calculator::SUNDAY - ]; - - $calculator = new Calculator(); - $calculator->setStartDate(new \DateTime('2000-12-27')); - $calculator->setFreeWeekDays($freeWeekDays); // repeat every week - $calculator->setHolidays($holidays); // repeat every year - $calculator->setFreeDays($freeDays); // don't repeat - - $calculator->addBusinessDays(3); // add X working days - - $result = $calculator->getDate(); // \DateTime - echo $result->format('Y-m-d'); // 2001-01-03 +# Example + +``` php +use \BusinessDays\Calculator; + +$holidays = [ + new \DateTime('2000-12-31'), + new \DateTime('2001-01-01') +]; + +$freeDays = [ + new \DateTime('2000-12-28') +]; + +$freeWeekDays = [ + Calculator::SATURDAY, + Calculator::SUNDAY +]; + +$calculator = new Calculator(); +$calculator->setStartDate(new \DateTime('2000-12-27')); +$calculator->setFreeWeekDays($freeWeekDays); // repeat every week +$calculator->setHolidays($holidays); // repeat every year +$calculator->setFreeDays($freeDays); // don't repeat + +$calculator->addBusinessDays(3); // add X working days + +$result = $calculator->getDate(); // \DateTime +echo $result->format('Y-m-d'); // 2001-01-03 +``` \ No newline at end of file