From 662db41baee404be3427b2b11b2d1fbf0aefcc8f Mon Sep 17 00:00:00 2001 From: Bertrand Dunogier Date: Sun, 22 Jan 2017 00:42:05 +0100 Subject: Changed parsing of login_extra_fields in guzzle auth --- .../GrabySiteConfigBuilder.php | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'src/Wallabag/CoreBundle/GuzzleSiteAuthenticator') diff --git a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php index 6d4129e8..1c866f17 100644 --- a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php +++ b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php @@ -54,7 +54,7 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder 'loginUri' => $config->login_uri ?: null, 'usernameField' => $config->login_username_field ?: null, 'passwordField' => $config->login_password_field ?: null, - 'extraFields' => is_array($config->login_extra_fields) ? $config->login_extra_fields : [], + 'extraFields' => $this->processExtraFields($config->login_extra_fields), 'notLoggedInXpath' => $config->not_logged_in_xpath ?: null, ]; @@ -65,4 +65,30 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder return new SiteConfig($parameters); } + + /** + * Processes login_extra_fields config, transforming an '=' separated array of strings + * into a key/value array. + * + * @param array|mixed $extraFieldsStrings + * + * @return array + */ + protected function processExtraFields($extraFieldsStrings) + { + if (!is_array($extraFieldsStrings)) { + return []; + } + + $extraFields = []; + foreach ($extraFieldsStrings as $extraField) { + if (strpos($extraField, '=') === false) { + continue; + } + list($fieldName, $fieldValue) = explode('=', $extraField, 2); + $extraFields[$fieldName] = $fieldValue; + } + + return $extraFields; + } } -- cgit v1.2.3 From 94b232bbb8de4699911a6446a1a96f75370cab50 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Tue, 9 May 2017 22:25:18 +0200 Subject: Skip auth when no credentials are found MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If we can’t find a credential for the current host, even if it required login, we won’t add them and website will be fetched without any login. --- .../GrabySiteConfigBuilder.php | 36 ++++++++++++++++------ 1 file changed, 27 insertions(+), 9 deletions(-) (limited to 'src/Wallabag/CoreBundle/GuzzleSiteAuthenticator') diff --git a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php index 1c866f17..a16ed49d 100644 --- a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php +++ b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php @@ -6,28 +6,35 @@ use BD\GuzzleSiteAuthenticator\SiteConfig\SiteConfig; use BD\GuzzleSiteAuthenticator\SiteConfig\SiteConfigBuilder; use Graby\SiteConfig\ConfigBuilder; use OutOfRangeException; +use Psr\Log\LoggerInterface; class GrabySiteConfigBuilder implements SiteConfigBuilder { /** - * @var \Graby\SiteConfig\ConfigBuilder + * @var ConfigBuilder */ private $grabyConfigBuilder; /** * @var array */ private $credentials; + /** + * @var LoggerInterface + */ + private $logger; /** * GrabySiteConfigBuilder constructor. * - * @param \Graby\SiteConfig\ConfigBuilder $grabyConfigBuilder - * @param array $credentials + * @param ConfigBuilder $grabyConfigBuilder + * @param array $credentials + * @param LoggerInterface $logger */ - public function __construct(ConfigBuilder $grabyConfigBuilder, array $credentials = []) + public function __construct(ConfigBuilder $grabyConfigBuilder, array $credentials, LoggerInterface $logger) { $this->grabyConfigBuilder = $grabyConfigBuilder; $this->credentials = $credentials; + $this->logger = $logger; } /** @@ -47,6 +54,12 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder $host = substr($host, 4); } + if (!isset($this->credentials[$host])) { + $this->logger->debug('Auth: no credentials available for host.', ['host' => $host]); + + return false; + } + $config = $this->grabyConfigBuilder->buildForHost($host); $parameters = [ 'host' => $host, @@ -56,14 +69,18 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder 'passwordField' => $config->login_password_field ?: null, 'extraFields' => $this->processExtraFields($config->login_extra_fields), 'notLoggedInXpath' => $config->not_logged_in_xpath ?: null, + 'username' => $this->credentials[$host]['username'], + 'password' => $this->credentials[$host]['password'], ]; - if (isset($this->credentials[$host])) { - $parameters['username'] = $this->credentials[$host]['username']; - $parameters['password'] = $this->credentials[$host]['password']; - } + $config = new SiteConfig($parameters); + + // do not leak password in log + $parameters['password'] = '**masked**'; - return new SiteConfig($parameters); + $this->logger->debug('Auth: add parameters.', ['host' => $host, 'parameters' => $parameters]); + + return $config; } /** @@ -85,6 +102,7 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder if (strpos($extraField, '=') === false) { continue; } + list($fieldName, $fieldValue) = explode('=', $extraField, 2); $extraFields[$fieldName] = $fieldValue; } -- cgit v1.2.3 From 150d9ec1dcca0f71ba19a7f55e599eb716541dc3 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 10 May 2017 10:37:53 +0200 Subject: Handle empty configuration --- .../CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Wallabag/CoreBundle/GuzzleSiteAuthenticator') diff --git a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php index a16ed49d..c712bb26 100644 --- a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php +++ b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php @@ -54,7 +54,7 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder $host = substr($host, 4); } - if (!isset($this->credentials[$host])) { + if (empty($this->credentials[$host])) { $this->logger->debug('Auth: no credentials available for host.', ['host' => $host]); return false; -- cgit v1.2.3 From 5fe65baee5910c887ba148b1163a1a53654dc324 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Tue, 30 May 2017 11:39:15 +0200 Subject: Fix some Scrutinizer issues --- .../CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'src/Wallabag/CoreBundle/GuzzleSiteAuthenticator') diff --git a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php index c712bb26..15aa0317 100644 --- a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php +++ b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php @@ -38,13 +38,7 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder } /** - * Builds the SiteConfig for a host. - * - * @param string $host The "www." prefix is ignored - * - * @return SiteConfig - * - * @throws OutOfRangeException If there is no config for $host + * {@inheritdoc} */ public function buildForHost($host) { -- cgit v1.2.3 From 26650fdbf8af8d716e712e9c9c8474b42f90722d Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Tue, 30 May 2017 12:47:25 +0200 Subject: Use a better way to set input for command Actually use the correct to way handle that http://symfony.com/doc/current/components/console/helpers/questionhelper.html#testing-a-command-that-expects-input --- .../CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php | 1 - 1 file changed, 1 deletion(-) (limited to 'src/Wallabag/CoreBundle/GuzzleSiteAuthenticator') diff --git a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php index 15aa0317..1c56fa9f 100644 --- a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php +++ b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php @@ -5,7 +5,6 @@ namespace Wallabag\CoreBundle\GuzzleSiteAuthenticator; use BD\GuzzleSiteAuthenticator\SiteConfig\SiteConfig; use BD\GuzzleSiteAuthenticator\SiteConfig\SiteConfigBuilder; use Graby\SiteConfig\ConfigBuilder; -use OutOfRangeException; use Psr\Log\LoggerInterface; class GrabySiteConfigBuilder implements SiteConfigBuilder -- cgit v1.2.3 From 5a9bc00726ddaf7c8798d4932d0a8b7a38422670 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 1 May 2017 22:13:17 +0200 Subject: Retrieve username/password from database Inject the current user & the repo to retrieve username/password from the database --- .../GrabySiteConfigBuilder.php | 32 ++++++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'src/Wallabag/CoreBundle/GuzzleSiteAuthenticator') diff --git a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php index 1c56fa9f..94615687 100644 --- a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php +++ b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php @@ -6,6 +6,8 @@ use BD\GuzzleSiteAuthenticator\SiteConfig\SiteConfig; use BD\GuzzleSiteAuthenticator\SiteConfig\SiteConfigBuilder; use Graby\SiteConfig\ConfigBuilder; use Psr\Log\LoggerInterface; +use Wallabag\CoreBundle\Repository\SiteCredentialRepository; +use Wallabag\UserBundle\Entity\User; class GrabySiteConfigBuilder implements SiteConfigBuilder { @@ -13,26 +15,36 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder * @var ConfigBuilder */ private $grabyConfigBuilder; + /** - * @var array + * @var SiteCredentialRepository */ - private $credentials; + private $credentialRepository; + /** * @var LoggerInterface */ private $logger; + /** + * @var User + */ + private $currentUser; + + /** * GrabySiteConfigBuilder constructor. * - * @param ConfigBuilder $grabyConfigBuilder - * @param array $credentials + * @param ConfigBuilder $grabyConfigBuilder + * @param User $currentUser + * @param SiteCredentialRepository $credentialRepository * @param LoggerInterface $logger */ - public function __construct(ConfigBuilder $grabyConfigBuilder, array $credentials, LoggerInterface $logger) + public function __construct(ConfigBuilder $grabyConfigBuilder, User $currentUser, SiteCredentialRepository $credentialRepository, LoggerInterface $logger) { $this->grabyConfigBuilder = $grabyConfigBuilder; - $this->credentials = $credentials; + $this->credentialRepository = $credentialRepository; + $this->currentUser = $currentUser; $this->logger = $logger; } @@ -47,7 +59,9 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder $host = substr($host, 4); } - if (empty($this->credentials[$host])) { + $credentials = $this->credentialRepository->findOneByHostAndUser($host, $this->currentUser->getId()); + + if (null === $credentials) { $this->logger->debug('Auth: no credentials available for host.', ['host' => $host]); return false; @@ -62,8 +76,8 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder 'passwordField' => $config->login_password_field ?: null, 'extraFields' => $this->processExtraFields($config->login_extra_fields), 'notLoggedInXpath' => $config->not_logged_in_xpath ?: null, - 'username' => $this->credentials[$host]['username'], - 'password' => $this->credentials[$host]['password'], + 'username' => $credentials['username'], + 'password' => $credentials['password'], ]; $config = new SiteConfig($parameters); -- cgit v1.2.3 From b8427f22f06cab58383ec3080f09715c712c65ef Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 1 May 2017 22:13:35 +0200 Subject: Add menu access to site credentials CRUD --- .../GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/Wallabag/CoreBundle/GuzzleSiteAuthenticator') diff --git a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php index 94615687..ae69492d 100644 --- a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php +++ b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php @@ -7,7 +7,7 @@ use BD\GuzzleSiteAuthenticator\SiteConfig\SiteConfigBuilder; use Graby\SiteConfig\ConfigBuilder; use Psr\Log\LoggerInterface; use Wallabag\CoreBundle\Repository\SiteCredentialRepository; -use Wallabag\UserBundle\Entity\User; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; class GrabySiteConfigBuilder implements SiteConfigBuilder { @@ -27,7 +27,7 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder private $logger; /** - * @var User + * @var Wallabag\UserBundle\Entity\User|null */ private $currentUser; @@ -36,16 +36,19 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder * GrabySiteConfigBuilder constructor. * * @param ConfigBuilder $grabyConfigBuilder - * @param User $currentUser + * @param TokenStorage $token * @param SiteCredentialRepository $credentialRepository * @param LoggerInterface $logger */ - public function __construct(ConfigBuilder $grabyConfigBuilder, User $currentUser, SiteCredentialRepository $credentialRepository, LoggerInterface $logger) + public function __construct(ConfigBuilder $grabyConfigBuilder, TokenStorage $token, SiteCredentialRepository $credentialRepository, LoggerInterface $logger) { $this->grabyConfigBuilder = $grabyConfigBuilder; $this->credentialRepository = $credentialRepository; - $this->currentUser = $currentUser; $this->logger = $logger; + + if ($token->getToken()) { + $this->currentUser = $token->getToken()->getUser(); + } } /** @@ -59,7 +62,10 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder $host = substr($host, 4); } - $credentials = $this->credentialRepository->findOneByHostAndUser($host, $this->currentUser->getId()); + $credentials = null; + if ($this->currentUser) { + $credentials = $this->credentialRepository->findOneByHostAndUser($host, $this->currentUser->getId()); + } if (null === $credentials) { $this->logger->debug('Auth: no credentials available for host.', ['host' => $host]); -- cgit v1.2.3 From 9de9f1e5ceed4ac7ecd27e1cb808e630a831f94b Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 3 May 2017 10:23:49 +0200 Subject: Add a live test for restricted article MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is not aimed to test if we can get the full article (since we aren't using real login/password) but mostly to test the full work (with authentication, etc.) Do not clean fixtured to avoid SQLite to re-use id for entry tag relation 😓 --- .../CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/Wallabag/CoreBundle/GuzzleSiteAuthenticator') diff --git a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php index ae69492d..62a3bc13 100644 --- a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php +++ b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php @@ -31,14 +31,13 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder */ private $currentUser; - /** * GrabySiteConfigBuilder constructor. * * @param ConfigBuilder $grabyConfigBuilder - * @param TokenStorage $token + * @param TokenStorage $token * @param SiteCredentialRepository $credentialRepository - * @param LoggerInterface $logger + * @param LoggerInterface $logger */ public function __construct(ConfigBuilder $grabyConfigBuilder, TokenStorage $token, SiteCredentialRepository $credentialRepository, LoggerInterface $logger) { -- cgit v1.2.3 From bead8b42da4f17238dc0d5e0f90184b224ec5df7 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Wed, 14 Jun 2017 15:02:34 +0200 Subject: Fix reviews Encrypt username too Redirect to list after saving credentials Fix typos Signed-off-by: Thomas Citharel --- .../CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/Wallabag/CoreBundle/GuzzleSiteAuthenticator') diff --git a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php index 62a3bc13..a79e6ebe 100644 --- a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php +++ b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php @@ -87,7 +87,8 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder $config = new SiteConfig($parameters); - // do not leak password in log + // do not leak usernames and passwords in log + $parameters['username'] = '**masked**'; $parameters['password'] = '**masked**'; $this->logger->debug('Auth: add parameters.', ['host' => $host, 'parameters' => $parameters]); -- cgit v1.2.3 From f808b01692a835673f328d7221ba8c212caa9b61 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 1 Jul 2017 09:52:38 +0200 Subject: Add a real configuration for CS-Fixer --- .../CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Wallabag/CoreBundle/GuzzleSiteAuthenticator') diff --git a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php index a79e6ebe..10689c62 100644 --- a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php +++ b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php @@ -6,8 +6,8 @@ use BD\GuzzleSiteAuthenticator\SiteConfig\SiteConfig; use BD\GuzzleSiteAuthenticator\SiteConfig\SiteConfigBuilder; use Graby\SiteConfig\ConfigBuilder; use Psr\Log\LoggerInterface; -use Wallabag\CoreBundle\Repository\SiteCredentialRepository; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; +use Wallabag\CoreBundle\Repository\SiteCredentialRepository; class GrabySiteConfigBuilder implements SiteConfigBuilder { @@ -57,7 +57,7 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder { // required by credentials below $host = strtolower($host); - if (substr($host, 0, 4) == 'www.') { + if (substr($host, 0, 4) === 'www.') { $host = substr($host, 4); } -- cgit v1.2.3 From 52b84c11a5b5474cd45271d937a46c6adfdf2749 Mon Sep 17 00:00:00 2001 From: Nicolas Hart Date: Sat, 29 Jul 2017 22:51:50 +0200 Subject: Fix some namespaces and phpdoc --- .../CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/Wallabag/CoreBundle/GuzzleSiteAuthenticator') diff --git a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php index 10689c62..da19fe31 100644 --- a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php +++ b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php @@ -8,6 +8,7 @@ use Graby\SiteConfig\ConfigBuilder; use Psr\Log\LoggerInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; use Wallabag\CoreBundle\Repository\SiteCredentialRepository; +use Wallabag\UserBundle\Entity\User; class GrabySiteConfigBuilder implements SiteConfigBuilder { @@ -27,7 +28,7 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder private $logger; /** - * @var Wallabag\UserBundle\Entity\User|null + * @var User|null */ private $currentUser; -- cgit v1.2.3 From 3ef055ced3d6ea0d2f15ba660602545f477e9c3c Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 9 Oct 2017 16:47:15 +0200 Subject: CS --- .../CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Wallabag/CoreBundle/GuzzleSiteAuthenticator') diff --git a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php index da19fe31..2c85da62 100644 --- a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php +++ b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php @@ -58,7 +58,7 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder { // required by credentials below $host = strtolower($host); - if (substr($host, 0, 4) === 'www.') { + if ('www.' === substr($host, 0, 4)) { $host = substr($host, 4); } @@ -113,7 +113,7 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder $extraFields = []; foreach ($extraFieldsStrings as $extraField) { - if (strpos($extraField, '=') === false) { + if (false === strpos($extraField, '=')) { continue; } -- cgit v1.2.3