Even when it *****ing well should be. Why do I need to do this to decode the bus schedule days to a seven-bit bitmap?

```
class DayWordsToBitmap
{
const SINGLEWORDDECODER = [
"monday" => ViewBusStopTimetables::MONDAY,
"tuesday" => ViewBusStopTimetables::TUESDAY,
"wednesday" => ViewBusStopTimetables::WEDNESDAY,
"thursday" => ViewBusStopTimetables::THURSDAY,
"friday" => ViewBusStopTimetables::FRIDAY,
"saturday" => ViewBusStopTimetables::SATURDAY,
"sunday" => ViewBusStopTimetables::SUNDAY];
public static function dayWordsToBitmap(string $id): int
{
$intCalculated = self::dayWordsToBitmapUsingCommaSeperatedList($id);
if ($intCalculated === 0) {
$intCalculated = self::dayWordsToBitmapOriginal($id);
}
return $intCalculated;
}
public static function dayWordsToBitmapUsingCommaSeperatedList(string $id)
{
$intCalculated = 0;
$arrWords = preg_split("/,/", $id);
foreach ($arrWords as $word) {
$word = trim(strtolower($word));
if (!isset(self::SINGLEWORDDECODER[$word])) {
return 0;
} else {
$intCalculated = $intCalculated | pow(2, self::SINGLEWORDDECODER[$word]);
}
}
return $intCalculated;
}
public static function dayWordsToBitmapOriginal(string $id)
{
switch ($id) {
// 1 (for Monday) through 7 (for Sunday)
case "Monday":
case "Sunday Night/Monday Morning":
case "Bank Holidays":
return pow(2, ViewBusStopTimetables::MONDAY);
case "Tuesday":
return pow(2, ViewBusStopTimetables::TUESDAY);
case "Wednesday":
return pow(2, ViewBusStopTimetables::WEDNESDAY);
case "Thursday":
return pow(2, ViewBusStopTimetables::THURSDAY);
case "Friday":
case "School Friday":
case "Non-School Friday":
return pow(2, ViewBusStopTimetables::FRIDAY);
case "Friday Night/Saturday Morning":
case "Saturday":
return pow(2, ViewBusStopTimetables::SATURDAY);
case "Saturday Night/Sunday Morning":
case "Sunday":
return pow(2, ViewBusStopTimetables::SUNDAY);
case "Monday to Friday":
case "Mon-Fri Schooldays":
case "Summer Monday to Friday Non-Schooldays":
case "Mon-Fri Non-Schooldays":
case "Mo-Fr Night/Tu-Sat Morning":
case "Monday - Friday":
case "MondayToFriday":
case "Monday,Tuesday,Wednesday,Thursday,Friday":
return pow(2, ViewBusStopTimetables::MONDAY) | pow(2, ViewBusStopTimetables::TUESDAY) | pow(2, ViewBusStopTimetables::WEDNESDAY) | pow(2, ViewBusStopTimetables::THURSDAY) | pow(2, ViewBusStopTimetables::FRIDAY);
case "Monday to Thursday":
case "Mo-Th Nights/Tu-Fr Morning":
case "Mon-Th Schooldays":
case "Mon-Th Non-Schooldays":
case "Monday -Thursday Non-Schooldays":
case "Monday,Tuesday,Wednesday,Thursday":
return pow(2, ViewBusStopTimetables::MONDAY) | pow(2, ViewBusStopTimetables::TUESDAY) | pow(2, ViewBusStopTimetables::WEDNESDAY) | pow(2, ViewBusStopTimetables::THURSDAY);
case "Monday,Tuesday,Wednesday,Friday":
return pow(2, ViewBusStopTimetables::MONDAY) | pow(2, ViewBusStopTimetables::TUESDAY) | pow(2, ViewBusStopTimetables::WEDNESDAY) | pow(2, ViewBusStopTimetables::FRIDAY);
case "Monday,Tuesday,Thursday,Friday":
return pow(2, ViewBusStopTimetables::MONDAY) | pow(2, ViewBusStopTimetables::TUESDAY) | pow(2, ViewBusStopTimetables::THURSDAY) | pow(2, ViewBusStopTimetables::FRIDAY);
case "Tuesday, Wednesday & Thursday":
case "Tuesday,Wednesday,Thursday":
return pow(2, ViewBusStopTimetables::TUESDAY) | pow(2, ViewBusStopTimetables::WEDNESDAY) | pow(2, ViewBusStopTimetables::THURSDAY);
case "Tuesday,Wednesday,Thursday,Friday":
return pow(2, ViewBusStopTimetables::TUESDAY) | pow(2, ViewBusStopTimetables::WEDNESDAY) | pow(2, ViewBusStopTimetables::THURSDAY) | pow(2, ViewBusStopTimetables::FRIDAY);
case "Tuesday,Wednesday,Thursday,Friday,Saturday":
return pow(2, ViewBusStopTimetables::TUESDAY) | pow(2, ViewBusStopTimetables::WEDNESDAY) | pow(2, ViewBusStopTimetables::THURSDAY) | pow(2, ViewBusStopTimetables::FRIDAY) | pow(2, ViewBusStopTimetables::SATURDAY);
case "Monday,Tuesday,Wednesday,Thursday,Sunday":
return pow(2, ViewBusStopTimetables::MONDAY) | pow(2, ViewBusStopTimetables::TUESDAY) | pow(2, ViewBusStopTimetables::WEDNESDAY) | pow(2, ViewBusStopTimetables::THURSDAY) | pow(2, ViewBusStopTimetables::SUNDAY);
case "MondayToSunday":
return pow(2, ViewBusStopTimetables::MONDAY) | pow(2, ViewBusStopTimetables::TUESDAY) | pow(2, ViewBusStopTimetables::WEDNESDAY) | pow(2, ViewBusStopTimetables::THURSDAY) | pow(2, ViewBusStopTimetables::FRIDAY) | pow(2, ViewBusStopTimetables::SATURDAY) | pow(2, ViewBusStopTimetables::SUNDAY);
case "Monday,Tuesday,Wednesday,Thursday,Friday,Saturday":
return pow(2, ViewBusStopTimetables::MONDAY) | pow(2, ViewBusStopTimetables::TUESDAY) | pow(2, ViewBusStopTimetables::WEDNESDAY) | pow(2, ViewBusStopTimetables::THURSDAY) | pow(2, ViewBusStopTimetables::FRIDAY) | pow(2, ViewBusStopTimetables::SATURDAY);
case "Wednesday,Thursday,Friday":
return pow(2, ViewBusStopTimetables::WEDNESDAY) | pow(2, ViewBusStopTimetables::THURSDAY) | pow(2, ViewBusStopTimetables::FRIDAY);
case "Wednesday,Friday":
return pow(2, ViewBusStopTimetables::WEDNESDAY) | pow(2, ViewBusStopTimetables::FRIDAY);
case "Saturday,Sunday":
return pow(2, ViewBusStopTimetables::SATURDAY) | pow(2, ViewBusStopTimetables::SUNDAY);
case "Monday,Tuesday,Wednesday,Thursday,Friday,Sunday":
return pow(2, ViewBusStopTimetables::MONDAY) | pow(2, ViewBusStopTimetables::TUESDAY) | pow(2, ViewBusStopTimetables::WEDNESDAY) | pow(2, ViewBusStopTimetables::THURSDAY) | pow(2, ViewBusStopTimetables::FRIDAY) | pow(2, ViewBusStopTimetables::SUNDAY);
case "Monday,Wednesday":
return pow(2, ViewBusStopTimetables::MONDAY) | pow(2, ViewBusStopTimetables::WEDNESDAY);
case "Tuesday,Thursday":
return pow(2, ViewBusStopTimetables::TUESDAY) | pow(2, ViewBusStopTimetables::THURSDAY);
case "":
return 0;
default:
ReportAllErrorsToCloudwatch::dieToCloudWatch(__FUNCTION__ . " " . $id, __CLASS__);
}
}
```

}