X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=src%2FWallabag%2FCoreBundle%2FHelper%2FHttpClientFactory.php;h=8891887b6e97d1a68ad3f783f130ac49879261d6;hb=463cb376e357d50c5913452fba68a70bf43492c9;hp=161a5e9fb41fc535b3dd8d517efd1684c7ff40f8;hpb=40f3ea57fbc86247495ef3c335f40f966a69aa50;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php b/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php index 161a5e9f..8891887b 100644 --- a/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php +++ b/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php @@ -18,23 +18,31 @@ class HttpClientFactory /** @var \GuzzleHttp\Cookie\CookieJar */ private $cookieJar; + private $restrictedAccess; + /** * HttpClientFactory constructor. * * @param \GuzzleHttp\Event\SubscriberInterface $authenticatorSubscriber * @param \GuzzleHttp\Cookie\CookieJar $cookieJar + * @param string $restrictedAccess this param is a kind of boolean. Values: 0 or 1 */ - public function __construct(SubscriberInterface $authenticatorSubscriber, CookieJar $cookieJar) + public function __construct(SubscriberInterface $authenticatorSubscriber, CookieJar $cookieJar, $restrictedAccess) { $this->authenticatorSubscriber = $authenticatorSubscriber; $this->cookieJar = $cookieJar; + $this->restrictedAccess = $restrictedAccess; } /** - * @return \GuzzleHttp\Client + * @return \GuzzleHttp\Client|null */ public function buildHttpClient() { + if (0 === (int) $this->restrictedAccess) { + return null; + } + // we clear the cookie to avoid websites who use cookies for analytics $this->cookieJar->clear(); // need to set the (shared) cookie jar