public function changeContractMonths(int $months) { $this->contractMonths = $months; } public function printStartDate() { echo "Start Date is " . $this->contractDate->format('Y-m-d') . PHP_EOL; } public function printEndDate() { echo "End Date is " . $this->contractDate->getEndDate($this->contractMonths) . PHP_EOL; } public function notifyEach2Weeks5Times() { $interval = new DateInterval('P2W'); $period = new DatePeriod($this->contractDate, $interval, 5, DatePeriod::EXCLUDE_START_DATE); foreach ($period as $nextDateTime) { echo $nextDateTime->format('Y-m-d') . PHP_EOL; } } } echo "Contrato de 12 meses desde la fecha actual." . PHP_EOL; $contract = new Contract(date("Y-m-d"), 12); echo $contract->printStartDate(); echo $contract->printEndDate(); echo "Cambiamos los meses de contrato a 24." . PHP_EOL; $contract->changeContractMonths(24); echo $contract->printEndDate(); echo PHP_EOL; echo "Recordatorio cada 2 semanas 5 veces:" . PHP_EOL; $contract->notifyEach2Weeks5Times();