diff options
author | AlexKlimenkov <shurick.klimenkov@gmail.com> | 2016-03-14 16:41:20 +0300 |
---|---|---|
committer | AlexKlimenkov <shurick.klimenkov@gmail.com> | 2016-03-14 16:41:20 +0300 |
commit | 0bcea2320e4235e6cfc0bcf65b917e45845bd5fe (patch) | |
tree | 6f567231ec547e3a9987b45ab7352587766457b5 /RecurringType.php | |
parent | 0b2d678903c2cf2ae375e968850a5e741036bd95 (diff) | |
parent | 888ede15fc86db7001fa4d28bc2a686ed41315a3 (diff) | |
download | scheduler-helper-php-0bcea2320e4235e6cfc0bcf65b917e45845bd5fe.zip scheduler-helper-php-0bcea2320e4235e6cfc0bcf65b917e45845bd5fe.tar.gz scheduler-helper-php-0bcea2320e4235e6cfc0bcf65b917e45845bd5fe.tar.bz2 |
Merge pull request #18 from mperednya/master
Performance tweaks.
Diffstat (limited to 'RecurringType.php')
-rw-r--r-- | RecurringType.php | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/RecurringType.php b/RecurringType.php index 9ad8ca5..96b062b 100644 --- a/RecurringType.php +++ b/RecurringType.php @@ -311,7 +311,8 @@ class RecurringType { //If recurring type has list of days, then get those days. $recurringWeekDays = $this->getWeekDaysListValue(); if($recurringWeekDays) { - for($i = 0; $i < count($recurringWeekDays); $i++) { + $daysCount = count($recurringWeekDays); + for($i = 0; $i < $daysCount; $i++) { $dayStep = $this->_getRecurringDayStep($dateStamp, $recurringWeekDays[$i]); array_push($recurringDays, SchedulerHelperDate::addDays($dateStamp, $dayStep)); } @@ -338,7 +339,10 @@ class RecurringType { */ public function getRecurringDates($intervalStartDateStamp, $intervalEndDateStamp, $countDates = NULL) { - if(!($this->getRecurringTypeStepValue() && $this->getRecurringTypeValue())) + $recurringTypeStep = $this->getRecurringTypeStepValue(); + $recType = $this->getRecurringTypeValue(); + + if(!($recType && $recType)) return false; //Correct interval by recurring interval. @@ -361,8 +365,7 @@ class RecurringType { $recurringDays = $this->_getRecurringDays($currentRecurringStartDateStamp); $recurringDates = array_merge($recurringDates, $recurringDays); - $recurringTypeStep = $this->getRecurringTypeStepValue(); - switch($this->getRecurringTypeValue()) { + switch($recType) { case self::REC_TYPE_DAY: $currentRecurringStartDateStamp = SchedulerHelperDate::addDays($currentRecurringStartDateStamp, $recurringTypeStep); break; |