public static function checkInList($value, $list, $errorMessage) { if (!in_array($value, $list)) { throw new InvalidArgumentException($errorMessage); } }