/** * Rather than defining each method individually we use this method to route the * method call to the appropriate handler. This method should not be used directly. * * @param string $method Method user attempted to use * @param mixed $args Array of arguments the user passed to the method * @since 1.0 * @static * @ignore */ public static function __callStatic($method, $args) { switch ($method) { case 'getApiCalls': return self::api_calls(); break; case 'setVerbose': if (count($args) < 1) { self::$verbose = false; } else { self::$verbose = (bool) $args[0]; } break; case 'toggleVerbose': self::$verbose = !self::$verbose; break; case 'version': case 'getVersion': return self::$version; break; case 'getKey': case 'getApiKey': return self::$api_key; break; case 'setKey': case 'setApiKey': if (count($args) < 1) { self::_set_api_key($args); } if (is_string($args[0])) { self::$api_key = $args[0]; } elseif (is_array($args[0])) { self::_set_api_key($args[0]); } else { return false; } return true; break; case 'getLastError': return self::$last_error; break; case 'call': if (count($args) != 1 || !is_array($args[0])) { throw new Exception('Must pass one associative array with proper values set.'); } $args = $args[0]; return self::_call_api($args); break; } }