installmentReminderEnabled = $this->envToBool( env('bds.installmentReminder.enabled', 'true') ); $this->installmentReminderBusinessDays = max( 0, (int) env('bds.installmentReminder.businessDays', 5) ); $this->installmentReminderFetchOverduePendingUtr = $this->envToBool( env('bds.installmentReminder.fetchOverduePendingUtr', 'false') ); $this->installmentReminderDaily = $this->envToBool( env('bds.installmentReminder.daily', 'true') ); $days = env('bds.installmentReminder.days', 'mon,tue,wed,thu,fri'); $this->installmentReminderDays = array_values(array_filter(array_map( static fn (string $day): string => strtolower(substr(trim($day), 0, 3)), explode(',', (string) $days) ))); } public function shouldFetchInstallmentRemindersToday(): bool { if (!$this->installmentReminderEnabled) { return false; } if ($this->installmentReminderDaily) { return true; } $today = strtolower(date('D')); return in_array($today, $this->installmentReminderDays, true); } private function envToBool(mixed $value): bool { return in_array(strtolower((string) $value), ['1', 'true', 'yes', 'on'], true); } }