public function getNextBillingPeriod(BillingAgreementInterface $billingAgreement) { //Find out to which date the billing agreement was already executed (eg. a billing request was already made) $startDate = $billingAgreement->getBilledToDate(); if (null == $startDate) { //If never billed: use the initial billing date as starting point $startDate = clone $billingAgreement->getInitialBillingDate(); } else { //Increase last billed to with one day; that will be the start date of the next period $startDate = clone $startDate->add(new \DateInterval('P1D')); } //Determine end date $endDate = $this->addMonth($startDate, 1); //TODO: allow more then just months return array($startDate, $endDate); }