Validate method name with requested query type.
authorMichael J. Rubinsky <mrubinsk@horde.org>
Sun, 28 Dec 2008 23:34:10 +0000 (18:34 -0500)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Sun, 28 Dec 2008 23:34:10 +0000 (18:34 -0500)
framework/Service_Vimeo/lib/Horde/Service/Vimeo/Simple.php

index cefa3f4..e4ad704 100644 (file)
@@ -58,6 +58,11 @@ class Horde_Service_Vimeo_Request {
     protected $_method;
     protected $_type;
 
+    protected $_methodTypes = array('user' => array('clips', 'likes', 'info', 'appears_in', 'all_clips', 'subscriptions', 'albums', 'channels', 'groups', 'contacts_clips', 'contacts_like'),
+                                    'group' => array('clips', 'users', 'info'),
+                                    'channel' => array('clips', 'info'),
+                                    'album' => array('clips', 'info'));
+
     public function __construct($args = array())
     {
         if (count($args) && !empty($args['type'])) {
@@ -90,12 +95,11 @@ class Horde_Service_Vimeo_Request {
      */
     public function __call($name, $args)
     {
-        switch ($name) {
-        case 'clips':
-            // ->clips()
-            $this->_method = $name;
-            return $this;
-       }
+        if (!in_array($name, $this->_methodType[$this->_type])) {
+            return;
+        }
+        $this->_method = $name;
+        return $this;
     }
 
     public function embed($options)