the getAlignment function throws this error because the $alignment variable is not defined before the switch statement