/** * Check existing period and registry new one if current calculation is complete. * * @param \Praxigento\BonusBase\Service\Period\Response\GetForPvBasedCalc $result * @param int $calcTypeId * @param string $periodType see \Praxigento\Core\Tool\IPeriod::TYPE_* * @param \Praxigento\BonusBase\Data\Entity\Period $periodData * @param \Praxigento\BonusBase\Data\Entity\Calculation $calcData * @return \Praxigento\BonusBase\Service\Period\Response\GetForPvBasedCalc */ public function _checkStateForExistingPeriod(\Praxigento\BonusBase\Service\Period\Response\GetForPvBasedCalc $result, $calcTypeId, $periodType, \Praxigento\BonusBase\Data\Entity\Period $periodData, \Praxigento\BonusBase\Data\Entity\Calculation $calcData) { if ($calcData->getState() == Cfg::CALC_STATE_COMPLETE) { $this->_logger->info("There is complete calculation for existing period. Create new period."); $result = $this->_registryNextPeriod($result, $calcTypeId, $periodType, $periodData); } else { $this->_logger->info("There is no complete calculation for existing period. Use existing period data."); $result->setCalcData($calcData); } return $result; }