php-store-hours
php-store-hours copied to clipboard
if no exceptions are specified, php spams warnings about 'Invalid argument supplied for foreach()'
are these two blocks causing php warnings?
foreach ($this->exceptions as $key => $value) {
$this->exceptions[$key] = array_filter($value, function ($element) {
return (trim($element) !== '');
});
}
foreach ($this->exceptions as $ex_day => $ex_hours) {
if (strtotime($ex_day) === $today) {
// Today is an exception, use alternate hours instead
$hours_today = $ex_hours;
}
}
wrapping them with if ($this->exceptions)
seems to stop the warnings, not sure if isset
should be used