]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
my code-to-verb logic was ab0rken; fixed
authorEvan Prodromou <evan@status.net>
Wed, 16 Mar 2011 19:22:15 +0000 (15:22 -0400)
committerEvan Prodromou <evan@status.net>
Wed, 16 Mar 2011 19:22:15 +0000 (15:22 -0400)
plugins/Event/RSVP.php

index 8bb2d2855d2f470d85f566f559353d7d77c91d1d..fad87aabc84ee7f8a21fb31fe96e42ffeb166a92 100644 (file)
@@ -161,6 +161,8 @@ class RSVP extends Managed_DataObject
         $rsvp->event_id    = $event->id;
         $rsvp->response      = self::codeFor($verb);
 
+        common_debug("Got value {$rsvp->response} for verb {$verb}");
+
         if (array_key_exists('created', $options)) {
             $rsvp->created = $options['created'];
         } else {
@@ -209,16 +211,36 @@ class RSVP extends Managed_DataObject
 
     function codeFor($verb)
     {
-        return ($verb == RSVP::POSITIVE) ? 'Y' :
-            ($verb == RSVP::NEGATIVE) ? 'N' :
-            ($verb == RSVP::POSSIBLE) ? '?' : null;
+        switch ($verb) {
+        case RSVP::POSITIVE:
+            return 'Y';
+            break;
+        case RSVP::NEGATIVE:
+            return 'N';
+            break;
+        case RSVP::POSSIBLE:
+            return '?';
+            break;
+        default:
+            throw new Exception("Unknown verb {$verb}");
+        }
     }
 
     static function verbFor($code)
     {
-        return ($code == 'Y') ? RSVP::POSITIVE :
-            ($code == 'N') ? RSVP::NEGATIVE :
-            ($code == '?') ? RSVP::POSSIBLE : null;
+        switch ($code) {
+        case 'Y':
+            return RSVP::POSITIVE;
+            break;
+        case 'N':
+            return RSVP::NEGATIVE;
+            break;
+        case '?':
+            return RSVP::POSSIBLE;
+            break;
+        default:
+            throw new Exception("Unknown code {$code}");
+        }
     }
 
     function getNotice()