From dadd5252360d7a26a7d39579e0b94906ebfe9074 Mon Sep 17 00:00:00 2001 From: Christian Gripp Date: Fri, 10 Feb 2017 15:48:35 +0000 Subject: [PATCH] Apply fixes from StyleCI --- src/Connection/Session.php | 6 +++--- src/Connection/SessionInterface.php | 6 +++--- src/Crawler/AbstractCrawler.php | 2 +- src/Crawler/EventInfoCrawler.php | 10 +++++----- src/Crawler/EventListCrawler.php | 18 +++++++++--------- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/Connection/Session.php b/src/Connection/Session.php index ba473d4..ab3f83d 100644 --- a/src/Connection/Session.php +++ b/src/Connection/Session.php @@ -43,7 +43,7 @@ public function __construct(string $name, string $key, int $subscriber = 0) /** * {@inheritdoc} */ - public function getName() : string + public function getName(): string { return $this->name; } @@ -51,7 +51,7 @@ public function getName() : string /** * {@inheritdoc} */ - public function getKey() : string + public function getKey(): string { return $this->key; } @@ -59,7 +59,7 @@ public function getKey() : string /** * {@inheritdoc} */ - public function getSubscriber() : int + public function getSubscriber(): int { return $this->subscriber; } diff --git a/src/Connection/SessionInterface.php b/src/Connection/SessionInterface.php index e6828cc..491bba3 100644 --- a/src/Connection/SessionInterface.php +++ b/src/Connection/SessionInterface.php @@ -16,19 +16,19 @@ interface SessionInterface * * @return string */ - public function getName() : string; + public function getName(): string; /** * Returns key. * * @return string */ - public function getKey() : string; + public function getKey(): string; /** * Returns subscriber. * * @return int */ - public function getSubscriber() : int; + public function getSubscriber(): int; } diff --git a/src/Crawler/AbstractCrawler.php b/src/Crawler/AbstractCrawler.php index 420cc7b..424650e 100644 --- a/src/Crawler/AbstractCrawler.php +++ b/src/Crawler/AbstractCrawler.php @@ -42,7 +42,7 @@ public function __construct(ConnectionInterface $connection) * * @return Crawler */ - final protected function crawl(string $url) : Crawler + final protected function crawl(string $url): Crawler { $content = $this->connection->loadPage($url); diff --git a/src/Crawler/EventInfoCrawler.php b/src/Crawler/EventInfoCrawler.php index 341cb33..3a6e93b 100644 --- a/src/Crawler/EventInfoCrawler.php +++ b/src/Crawler/EventInfoCrawler.php @@ -20,7 +20,7 @@ final class EventInfoCrawler extends AbstractCrawler * * @return array */ - public function getEventInfo(int $id) : array + public function getEventInfo(int $id): array { $node = $this->crawlEvent($id); $timeNode = $node->filter('.qa-event-date'); @@ -45,11 +45,11 @@ public function getEventInfo(int $id) : array * * @return array */ - private function readBands(Crawler $node) : array + private function readBands(Crawler $node): array { $bandNode = $node->filter('.grid-items'); - return $bandNode->filter('.grid-items-item')->each(function (Crawler $node, $i) : array{ + return $bandNode->filter('.grid-items-item')->each(function (Crawler $node, $i): array { return array( 'image' => $this->parseImage($node->filter('.grid-items-cover-image-image img')), 'name' => $this->parseString($node->filter('.grid-items-item-main-text')), @@ -63,7 +63,7 @@ private function readBands(Crawler $node) : array * * @return array */ - private function readVenues(Crawler $node) : array + private function readVenues(Crawler $node): array { $venueNode = $node->filter('.event-detail'); $addressNode = $venueNode->filter('.event-detail-address'); @@ -86,7 +86,7 @@ private function readVenues(Crawler $node) : array * * @return Crawler */ - private function crawlEvent(int $id) : Crawler + private function crawlEvent(int $id): Crawler { $url = 'http://www.last.fm/de/event/'.$id; diff --git a/src/Crawler/EventListCrawler.php b/src/Crawler/EventListCrawler.php index 6439278..bcd5758 100644 --- a/src/Crawler/EventListCrawler.php +++ b/src/Crawler/EventListCrawler.php @@ -20,11 +20,11 @@ final class EventListCrawler extends AbstractCrawler * * @return int[] */ - public function getUserYears(string $username) : array + public function getUserYears(string $username): array { $node = $this->crawlEventList($username); - $years = $node->filter('.content-top .secondary-nav-item-link')->each(function (Crawler $node, $i) : array{ + $years = $node->filter('.content-top .secondary-nav-item-link')->each(function (Crawler $node, $i): array { if ($i > 0) { return (int) trim($node->text()); } @@ -45,11 +45,11 @@ public function getUserYears(string $username) : array * * @return array */ - public function getEvents(string $username, int $year, int $page = 1) : array + public function getEvents(string $username, int $year, int $page = 1): array { $node = $this->crawlEventList($username, $year, $page); - return $node->filter('.events-list-item')->each(function (Crawler $node, $i) : array{ + return $node->filter('.events-list-item')->each(function (Crawler $node, $i): array { $eventNode = $node->filter('.events-list-item-event--title a'); $id = preg_replace('/.*\/(\d+)+.*/', '$1', $this->parseUrl($eventNode)); @@ -70,7 +70,7 @@ public function getEvents(string $username, int $year, int $page = 1) : array * * @return int */ - public function getYearPages(string $username, int $year) : int + public function getYearPages(string $username, int $year): int { $node = $this->crawlEventList($username, $year); @@ -86,7 +86,7 @@ public function getYearPages(string $username, int $year) : int * * @return int */ - public function getYearCount(string $username, int $year, int $page = 1) : int + public function getYearCount(string $username, int $year, int $page = 1): int { $node = $this->crawlEventList($username, $year, $page); @@ -108,7 +108,7 @@ public function getYearCount(string $username, int $year, int $page = 1) : int * * @return int */ - private function countListPages(Crawler $node) : int + private function countListPages(Crawler $node): int { $pagination = $this->parseString($node->filter('.pagination .pages')); @@ -120,7 +120,7 @@ private function countListPages(Crawler $node) : int * * @return int */ - private function countListEvents(Crawler $node) : int + private function countListEvents(Crawler $node): int { return $node->filter('.events-list-item')->count(); } @@ -132,7 +132,7 @@ private function countListEvents(Crawler $node) : int * * @return Crawler */ - private function crawlEventList(string $username, int $year = 2000, int $page = 1) : Crawler + private function crawlEventList(string $username, int $year = 2000, int $page = 1): Crawler { $url = 'http://www.last.fm/user/'.$username.'/events/'.$year.'?page='.$page;