From 40bdf2b328184d8e6d6786556c9a7a5d53b04e17 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Tue, 21 Jul 2009 12:40:44 -0400 Subject: [PATCH] Allow injecting of a Horde_Log_Logger and a Horde_Cache. --- .../Service_Twitter/lib/Horde/Service/Twitter.php | 23 ++++++++++++++++++++++ .../lib/Horde/Service/Twitter/Account.php | 5 ++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/framework/Service_Twitter/lib/Horde/Service/Twitter.php b/framework/Service_Twitter/lib/Horde/Service/Twitter.php index 5a35a82b9..7e116186d 100644 --- a/framework/Service_Twitter/lib/Horde/Service/Twitter.php +++ b/framework/Service_Twitter/lib/Horde/Service/Twitter.php @@ -13,9 +13,11 @@ 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 diff --git a/framework/Service_Twitter/lib/Horde/Service/Twitter/Account.php b/framework/Service_Twitter/lib/Horde/Service/Twitter/Account.php index 4062fb07b..b3b09e31d 100644 --- a/framework/Service_Twitter/lib/Horde/Service/Twitter/Account.php +++ b/framework/Service_Twitter/lib/Horde/Service/Twitter/Account.php @@ -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() -- 2.11.0