/** * @param null|array|Gass\Http\Interface $http * @throws Gass\Exception\InvalidArgumentException * @return Gass\GoogleAnalyticsServerSide */ public function setHttp($http = null) { if ($http !== null && !is_array($http) && !$http instanceof Http\HttpInterface) { throw new Exception\InvalidArgumentException('http must be an array, null' . ' or a class which implements Gass\\Http\\Interface.'); } if ($http !== null) { if ($http instanceof Http\HttpInterface) { Http\Http::getInstance(array(), $http); } elseif (is_array($http)) { Http\Http::getInstance($http); } } Http\Http::setAcceptLanguage($this->getAcceptLanguage())->setRemoteAddress($this->getRemoteAddress())->setUserAgent($this->getUserAgent()); $this->http = $http; return $this; }