Add "json" option
[shpub.git] / src / shpub / Validator.php
index 1da91cb..c751595 100644 (file)
@@ -28,5 +28,18 @@ class Validator
 
         return $url;
     }
+
+    public static function rsvp($answer)
+    {
+        $allowed = ['yes', 'no', 'maybe'];
+        if (false === array_search($answer, $allowed)) {
+            Log::err(
+                'Invalid RSVP answer given; allowed are: '
+                . implode(', ', $allowed)
+            );
+            return false;
+        }
+        return $answer;
+    }
 }
 ?>