summaryrefslogtreecommitdiffstats
path: root/lib/PostProcessor/LWNProcessor.php
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2019-01-28 22:32:49 +0100
committerGitHub <noreply@github.com>2019-01-28 22:32:49 +0100
commit9cd871983a368752d122a73da244606bdeba312f (patch)
treed1882e1e677d7cee12926e5688ccfbfd31a505f5 /lib/PostProcessor/LWNProcessor.php
parent31b2f194af74bdba60bdd2640e5fc47340157795 (diff)
parentbecce6b7520912257c3d72697a3aefec9923a467 (diff)
Merge pull request #382 from SMillerDev/codestyle_psr2
Define an official codestyle and adhere to it.
Diffstat (limited to 'lib/PostProcessor/LWNProcessor.php')
-rw-r--r--lib/PostProcessor/LWNProcessor.php19
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/PostProcessor/LWNProcessor.php b/lib/PostProcessor/LWNProcessor.php
index 3e4fbbdd0..1028df100 100644
--- a/lib/PostProcessor/LWNProcessor.php
+++ b/lib/PostProcessor/LWNProcessor.php
@@ -31,7 +31,7 @@ class LWNProcessor implements ItemProcessorInterface
* @param $user
* @param $password
*/
- public function __construct($user, $password, IClientService $clientService)
+ public function __construct($user, $password, IClientService $clientService)
{
$this->user = $user;
$this->password = $password;
@@ -39,7 +39,7 @@ class LWNProcessor implements ItemProcessorInterface
$this->cookieJar = new CookieJar();
}
- private function login()
+ private function login()
{
if ($this->cookieJar->count() > 0) {
return true;
@@ -50,7 +50,8 @@ class LWNProcessor implements ItemProcessorInterface
$client = $this->clientService->newClient();
$response = $client->post(
- 'https://lwn.net/login', [
+ 'https://lwn.net/login',
+ [
'cookies' => $this->cookieJar,
'body' => [
'Username' => $this->user,
@@ -62,16 +63,18 @@ class LWNProcessor implements ItemProcessorInterface
return ($response->getStatusCode() === 200 && $this->cookieJar->count() > 0);
}
- private function getBody($url)
+ private function getBody($url)
{
$client = $this->clientService->newClient();
$response = $client->get(
- $url, [
+ $url,
+ [
'cookies' => $this->cookieJar
]
);
$parser = new RuleParser(
- $response->getBody(), [
+ $response->getBody(),
+ [
'body' => array(
'//div[@class="ArticleText"]',
),
@@ -85,7 +88,7 @@ class LWNProcessor implements ItemProcessorInterface
return str_replace('href="/', 'href="https://lwn.net/', $articleBody);
}
- private function canHandle($url)
+ private function canHandle($url)
{
$regex = '%(?:https?://|//)?(?:www.)?lwn.net%';
@@ -100,7 +103,7 @@ class LWNProcessor implements ItemProcessorInterface
* @param Item $item
* @return bool
*/
- public function execute(Feed $feed, Item $item)
+ public function execute(Feed $feed, Item $item)
{
if ($this->canHandle($item->getUrl())) {
$loggedIn = $this->login();