Move this to the base class.
authorMichael J. Rubinsky <mrubinsk@horde.org>
Tue, 22 Sep 2009 00:00:00 +0000 (20:00 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Tue, 29 Sep 2009 20:53:57 +0000 (16:53 -0400)
kronolith/lib/Resource/Base.php
kronolith/lib/Resource/Single.php

index a9c1db0..405eace 100644 (file)
@@ -128,6 +128,32 @@ abstract class Kronolith_Resource_Base
     }
 
     /**
+     * Check availability and return an appropriate Kronolith response code.
+     *
+     * @param Kronolith_Event $event  The event to check on
+     *
+     * @return integer Kronolith::RESPONSE* constant
+     */
+    public function getResponse($event)
+    {
+        switch($this->getResponseType()) {
+        case Kronolith_Resource::RESPONSETYPE_ALWAYS_ACCEPT:
+            return Kronolith::RESPONSE_ACCEPTED;
+        case Kronolith_Resource::RESPONSETYPE_AUTO:
+            if ($this->isFree($event)) {
+                return Kronolith::RESPONSE_ACCEPTED;
+            } else {
+                return Kronolith::RESPONSE_DECLINED;
+            }
+        case Kronolith_Resource::RESPONSETYPE_ALWAYS_DECLINE:
+            return Kronolith::RESPONSE_DECLINED;
+        case Kronolith_Resource::RESPONSETYPE_NONE:
+        case Kronolith_Resource::RESPONSETYPE_MANUAL:
+            return Kronolith::RESPONSE_NONE;
+        }
+    }
+
+    /**
      * Determine if event is free for specified time
      *
      * @param $startTime
index 5b5c902..82f4bdf 100644 (file)
@@ -119,32 +119,6 @@ class Kronolith_Resource_Single extends Kronolith_Resource_Base
     }
 
     /**
-     * Check availability and return an appropriate Kronolith response code.
-     *
-     * @param Kronolith_Event $event  The event to check on
-     *
-     * @return integer Kronolith::RESPONSE* constant
-     */
-    function getResponse($event)
-    {
-        switch($this->getResponseType()) {
-        case Kronolith_Resource::RESPONSETYPE_ALWAYS_ACCEPT:
-            return Kronolith::RESPONSE_ACCEPTED;
-        case Kronolith_Resource::RESPONSETYPE_AUTO:
-            if ($this->isFree($event)) {
-                return Kronolith::RESPONSE_ACCEPTED;
-            } else {
-                return Kronolith::RESPONSE_DECLINED;
-            }
-        case Kronolith_Resource::RESPONSETYPE_ALWAYS_DECLINE:
-            return Kronolith::RESPONSE_DECLINED;
-        case Kronolith_Resource::RESPONSETYPE_NONE:
-        case Kronolith_Resource::RESPONSETYPE_MANUAL:
-            return Kronolith::RESPONSE_NONE;
-        }
-    }
-
-    /**
      * Obtain the freebusy information for this resource.
      *
      * @return unknown_type