Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply fixes from StyleCI #5

Merged
merged 1 commit into from Feb 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Connection/Session.php
Expand Up @@ -43,23 +43,23 @@ public function __construct(string $name, string $key, int $subscriber = 0)
/**
* {@inheritdoc}
*/
public function getName() : string
public function getName(): string
{
return $this->name;
}

/**
* {@inheritdoc}
*/
public function getKey() : string
public function getKey(): string
{
return $this->key;
}

/**
* {@inheritdoc}
*/
public function getSubscriber() : int
public function getSubscriber(): int
{
return $this->subscriber;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Connection/SessionInterface.php
Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion src/Crawler/AbstractCrawler.php
Expand Up @@ -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);

Expand Down
10 changes: 5 additions & 5 deletions src/Crawler/EventInfoCrawler.php
Expand Up @@ -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');
Expand All @@ -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')),
Expand All @@ -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');
Expand All @@ -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;

Expand Down
18 changes: 9 additions & 9 deletions src/Crawler/EventListCrawler.php
Expand Up @@ -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());
}
Expand All @@ -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));
Expand All @@ -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);

Expand All @@ -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);

Expand All @@ -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'));

Expand All @@ -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();
}
Expand All @@ -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;

Expand Down