<?php
class ConvertIntToDateByDayNumbers {
/**
* if parameter is integer and is greater than zero adds to actual date number days == $expire otherwise function return default value
*
* @param string $expire
* @return string
*/
public static function init(string $expire):string {
if (!is_numeric($expire) || $expire < 0) {
return $expire;
}
return date('Y-m-d', strtotime("+" . $expire . "days"));
}
}