HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers95/rentman.io/app/Komma/Kms/KmsService.php
<?php

/**
 * Short description for the file.
 *
 * @copyright   (c) 2012-2015, Komma
 */

namespace App\Komma\Kms;

class KmsService
{
    public function calculateStartAndEndDate($year, $month, $day, $period = 'month')
    {
        switch ($period) {
            case'month':
                $start = new \DateTime('first day of '.$year.'-'.$month);
                //Fist day of the month
                $month++;
                //check if the month is now 13
                if ($month > 12) {
                    //yes reset to january and add one year
                    $month = 1;
                    $year++;
                }

                //first day of next month (at 00:00:00)
                $end = new \DateTime('first day of  '.$year.'-'.($month));
                break;
        }

        return ['start'=> $start, 'end'=> $end];
    }
}