From: Michael J. Rubinsky Date: Tue, 24 Feb 2009 17:22:13 +0000 (-0500) Subject: If we don't have a request object in $context, check for a controller X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=d9a30589419f7d58d7192c7cf663210b5312d2eb;p=horde.git If we don't have a request object in $context, check for a controller and get it from there. --- diff --git a/framework/Service_Facebook/lib/Horde/Service/Facebook.php b/framework/Service_Facebook/lib/Horde/Service/Facebook.php index a0b967884..f70ce3528 100644 --- a/framework/Service_Facebook/lib/Horde/Service/Facebook.php +++ b/framework/Service_Facebook/lib/Horde/Service/Facebook.php @@ -129,21 +129,19 @@ class Horde_Service_Facebook */ public function __construct($api_key, $secret, $context) { - // We require a http client object, but we can get it from a - // controller if we have one. - if (empty($context['http_client']) && empty($context['controller'])) { + // We require a http client object. + if (empty($context['http_client'])) { throw new InvalidArgumentException('A http client object is required'); - } elseif (!empty($context['http_client'])) { - $this->_http = $context['http_client']; - } else { - $this->_http = $context['controller']->getRequest(); } - // Required Horde_Controller_Request object - if (empty($context['http_request'])) { + // Required Horde_Controller_Request object, but we can also get it + // if we have a Horde_Controller object. + if (empty($context['http_request']) && empty($context['controller'])) { throw new InvalidArgumentException('A http request object is required'); - } else { + } elseif (!empty($context['http_request'])) { $this->_request = $context['http_request']; + } else { + $this->_request = $context['controller']->request; } // Optional Horde_Log_Logger