diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2017-03-28 14:07:42 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2017-03-28 14:07:42 +0200 |
commit | 7d1d961267c129e2110ce9cc14c5a9d0a7d255cb (patch) | |
tree | d260d7b4ffc8466d7d410ec61bd896bdadd8456e /src/Wallabag/CoreBundle/Helper | |
parent | e1cc8fd79921fdff9999087ba896c88b14ffc0cd (diff) | |
parent | 6ae579e43f6a4ffe607a6361191366410d19f806 (diff) | |
download | wallabag-7d1d961267c129e2110ce9cc14c5a9d0a7d255cb.tar.gz wallabag-7d1d961267c129e2110ce9cc14c5a9d0a7d255cb.tar.zst wallabag-7d1d961267c129e2110ce9cc14c5a9d0a7d255cb.zip |
Merge remote-tracking branch 'origin/master' into 2.3
Diffstat (limited to 'src/Wallabag/CoreBundle/Helper')
-rw-r--r-- | src/Wallabag/CoreBundle/Helper/HttpClientFactory.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php b/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php index 8891887b..1ac8feb1 100644 --- a/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php +++ b/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php | |||
@@ -6,6 +6,7 @@ use Graby\Ring\Client\SafeCurlHandler; | |||
6 | use GuzzleHttp\Client; | 6 | use GuzzleHttp\Client; |
7 | use GuzzleHttp\Cookie\CookieJar; | 7 | use GuzzleHttp\Cookie\CookieJar; |
8 | use GuzzleHttp\Event\SubscriberInterface; | 8 | use GuzzleHttp\Event\SubscriberInterface; |
9 | use Psr\Log\LoggerInterface; | ||
9 | 10 | ||
10 | /** | 11 | /** |
11 | * Builds and configures the Guzzle HTTP client. | 12 | * Builds and configures the Guzzle HTTP client. |
@@ -19,6 +20,7 @@ class HttpClientFactory | |||
19 | private $cookieJar; | 20 | private $cookieJar; |
20 | 21 | ||
21 | private $restrictedAccess; | 22 | private $restrictedAccess; |
23 | private $logger; | ||
22 | 24 | ||
23 | /** | 25 | /** |
24 | * HttpClientFactory constructor. | 26 | * HttpClientFactory constructor. |
@@ -26,12 +28,14 @@ class HttpClientFactory | |||
26 | * @param \GuzzleHttp\Event\SubscriberInterface $authenticatorSubscriber | 28 | * @param \GuzzleHttp\Event\SubscriberInterface $authenticatorSubscriber |
27 | * @param \GuzzleHttp\Cookie\CookieJar $cookieJar | 29 | * @param \GuzzleHttp\Cookie\CookieJar $cookieJar |
28 | * @param string $restrictedAccess this param is a kind of boolean. Values: 0 or 1 | 30 | * @param string $restrictedAccess this param is a kind of boolean. Values: 0 or 1 |
31 | * @param LoggerInterface $logger | ||
29 | */ | 32 | */ |
30 | public function __construct(SubscriberInterface $authenticatorSubscriber, CookieJar $cookieJar, $restrictedAccess) | 33 | public function __construct(SubscriberInterface $authenticatorSubscriber, CookieJar $cookieJar, $restrictedAccess, LoggerInterface $logger) |
31 | { | 34 | { |
32 | $this->authenticatorSubscriber = $authenticatorSubscriber; | 35 | $this->authenticatorSubscriber = $authenticatorSubscriber; |
33 | $this->cookieJar = $cookieJar; | 36 | $this->cookieJar = $cookieJar; |
34 | $this->restrictedAccess = $restrictedAccess; | 37 | $this->restrictedAccess = $restrictedAccess; |
38 | $this->logger = $logger; | ||
35 | } | 39 | } |
36 | 40 | ||
37 | /** | 41 | /** |
@@ -39,8 +43,10 @@ class HttpClientFactory | |||
39 | */ | 43 | */ |
40 | public function buildHttpClient() | 44 | public function buildHttpClient() |
41 | { | 45 | { |
46 | $this->logger->log('debug', 'Restricted access config enabled?', array('enabled' => (int) $this->restrictedAccess)); | ||
47 | |||
42 | if (0 === (int) $this->restrictedAccess) { | 48 | if (0 === (int) $this->restrictedAccess) { |
43 | return null; | 49 | return; |
44 | } | 50 | } |
45 | 51 | ||
46 | // we clear the cookie to avoid websites who use cookies for analytics | 52 | // we clear the cookie to avoid websites who use cookies for analytics |