Allow injecting of a Horde_Log_Logger and a Horde_Cache.
authorMichael J. Rubinsky <mrubinsk@horde.org>
Tue, 21 Jul 2009 16:40:44 +0000 (12:40 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Tue, 21 Jul 2009 16:40:44 +0000 (12:40 -0400)
framework/Service_Twitter/lib/Horde/Service/Twitter.php
framework/Service_Twitter/lib/Horde/Service/Twitter/Account.php

index 5a35a82..7e11618 100644 (file)
 class Horde_Service_Twitter
 {
 
+    /* Constants */
     const REQUEST_TOKEN_URL = 'http://twitter.com/oauth/request_token';
     const USER_AUTHORIZE_URL = 'http://twitter.com/oauth/authorize';
     const ACCESS_TOKEN_URL = 'http://twitter.com/oauth/access_token';
+
     /**
      * Cache for the various objects we lazy load in __get()
      *
@@ -24,6 +26,19 @@ class Horde_Service_Twitter
     protected $_objCache = array();
 
     /**
+     * (Optional) Cache object
+     *
+     * @var Horde_Cache
+     */
+    protected $_responseCache;
+
+    /**
+     *
+     * @var Horde_Log_Logger
+     */
+    protected $_logger;
+
+    /**
      * Configuration values
      *
      * @var array
@@ -66,6 +81,14 @@ class Horde_Service_Twitter
         // TODO: Check for req'd config
         $this->_config = $config;
 
+        if (!empty($config['cache'])) {
+            $this->_responseCache = $config['cache'];
+        }
+
+        if (!empty($config['logger'])) {
+            $this->_logger = $config['logger'];
+        }
+
         // Need to determine the type of authentication we will be using early..
         if (!empty($config['oauth'])) {
             // OAuth
index 4062fb0..b3b09e3 100644 (file)
@@ -48,9 +48,8 @@ class Horde_Service_Twitter_Account
     }
 
     /**
-     * Ends the current session.
-     *
-     * @TODO: Verify that this invalidates any OAuth keys/secrets
+     * Ends the current session, invalidates the current auth token if using
+     * OAuth.
      *
      */
     public function endSession()