Skip to content

Commit

Permalink
php cs/cbf fixes [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
Irfan committed Apr 24, 2020
1 parent 878cf89 commit b1d374d
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 16 deletions.
10 changes: 7 additions & 3 deletions src/Helper/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public static function youtubeIdFromUrl(string $url) : string
{
/**
* https://gist.github.com/ghalusa/6c7f3a00fd2383e5ef33
* Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored)
* Here is a sample of the URLs this regex matches:
* (there can be more content after the given URL that will be ignored)
* http://youtu.be/dQw4w9WgXcQ
* http://www.youtube.com/embed/dQw4w9WgXcQ
* http://www.youtube.com/watch?v=dQw4w9WgXcQ
Expand All @@ -34,7 +34,11 @@ public static function youtubeIdFromUrl(string $url) : string
* It also works on the youtube-nocookie.com URL with the same above options.
* It will also pull the ID from the URL in an embed code (both iframe and object tags)
*/
preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $url, $match);
preg_match(
'%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i',
$url,
$match
);

return $match[1];
}
Expand Down
16 changes: 12 additions & 4 deletions src/MyAnimeList/MalClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -1226,8 +1226,9 @@ public function getPopularEpisodes(Request\Watch\PopularEpisodesRequest $request
* @throws BadResponseException
* @throws ParserException
*/
public function getRecentPromotionalVideos(Request\Watch\RecentPromotionalVideosRequest $request) : Model\Watch\PromotionalVideos
{
public function getRecentPromotionalVideos(
Request\Watch\RecentPromotionalVideosRequest $request
) : Model\Watch\PromotionalVideos {
$crawler = $this->ghoutte->request('GET', $request->getPath());
try {
$parser = new Parser\Watch\WatchPromotionalVideosParser($crawler);
Expand All @@ -1244,8 +1245,9 @@ public function getRecentPromotionalVideos(Request\Watch\RecentPromotionalVideos
* @throws BadResponseException
* @throws ParserException
*/
public function getPopularPromotionalVideos(Request\Watch\PopularPromotionalVideosRequest $request) : Model\Watch\PromotionalVideos
{
public function getPopularPromotionalVideos(
Request\Watch\PopularPromotionalVideosRequest $request
) : Model\Watch\PromotionalVideos {
$crawler = $this->ghoutte->request('GET', $request->getPath());
try {
$parser = new Parser\Watch\WatchPromotionalVideosParser($crawler);
Expand Down Expand Up @@ -1274,6 +1276,12 @@ public function getUserRecommendations(Request\User\UserRecommendationsRequest $
}
}

/**
* @param Request\User\UserClubsRequest $request
* @return array
* @throws BadResponseException
* @throws ParserException
*/
public function getUserClubs(Request\User\UserClubsRequest $request) : array
{
$crawler = $this->ghoutte->request('GET', $request->getPath());
Expand Down
2 changes: 1 addition & 1 deletion src/Parser/User/ClubParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function getClubs(): array
$node = $this->crawler
->filterXPath('//*[@id="content"]/table/tr/td[2]/ol/li');

return $node->each(function(Crawler $crawler) {
return $node->each(function (Crawler $crawler) {
return Model\Common\ClubMeta::factory(
Parser::clubIdFromUrl(
$crawler->filterXPath('//a')->attr('href')
Expand Down
5 changes: 4 additions & 1 deletion src/Parser/Watch/EpisodeListItemParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ public function getEpisodes(): array
{
$episodes = [];

$node = $this->crawler->filterXPath('//div[contains(@class, "video-list")]/div[contains(@class, "info-container")]/div[contains(@class, "title")]/a');
$node = $this->crawler->filterXPath(
'//div[contains(@class, "video-list")]
/div[contains(@class, "info-container")]/div[contains(@class, "title")]/a'
);

$episodes = $node->each(function (Crawler $crawler) {

Expand Down
4 changes: 3 additions & 1 deletion src/Parser/Watch/PromotionalVideoListItemParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ public function getPromoMedia(): YoutubeMeta

public function getPromoTitle(): string
{
$node = $this->crawler->filterXPath('//div[contains(@class, "video-list")]/a/div[contains(@class, "info-container")]/span');
$node = $this->crawler->filterXPath('
//div[contains(@class, "video-list")]/a/div[contains(@class, "info-container")]/span
');
return $node->text();
}
}
5 changes: 4 additions & 1 deletion src/Parser/Watch/WatchEpisodesParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ public function getModel(): Model\Watch\Episodes

public function getResults() : array
{
$node = $this->crawler->filterXPath('//*[@id="content"]/div[3]/div/div[contains(@class, "video-list-outer-vertical")]');
$node = $this->crawler->filterXPath(
'//*[@id="content"]/div[3]/div/div[contains(@class, "video-list-outer-vertical")]
'
);

if (!$node->count()) {
return [];
Expand Down
12 changes: 9 additions & 3 deletions src/Parser/Watch/WatchPromotionalVideosParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ public function getModel(): Model\Watch\PromotionalVideos

public function getResults() : array
{
$node = $this->crawler->filterXPath('//*[@id="content"]/div[3]/div/div[contains(@class, "video-list-outer-vertical")]');
$node = $this->crawler->filterXPath(
'//*[@id="content"]/div[3]/div/div[contains(@class, "video-list-outer-vertical")]'
);

if (!$node->count()) {
return [];
Expand All @@ -47,7 +49,9 @@ public function getResults() : array

public function getHasNextPage() : bool
{
$node = $this->crawler->filterXPath('//*[@id="content"]/div[contains(@class, "pagination")]/a[contains(text(), "More")]');
$node = $this->crawler->filterXPath(
'//*[@id="content"]/div[contains(@class, "pagination")]/a[contains(text(), "More")]'
);

if ($node->count()) {
return true;
Expand All @@ -58,7 +62,9 @@ public function getHasNextPage() : bool

public function getLastVisiblePage() : int
{
$node = $this->crawler->filterXPath('//*[@id="content"]/div[contains(@class, "pagination")]/span[@class="link-blue-box"]');
$node = $this->crawler->filterXPath(
'//*[@id="content"]/div[contains(@class, "pagination")]/span[@class="link-blue-box"]'
);

if (!$node->count()) {
return 1;
Expand Down
2 changes: 1 addition & 1 deletion src/Request/User/UserClubsRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class UserClubsRequest implements RequestInterface
/**
* @var string
*/
private $username;
private $username;

/**
* UserClubsRequest constructor.
Expand Down
2 changes: 1 addition & 1 deletion src/Request/User/UserRecommendationsRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class UserRecommendationsRequest implements RequestInterface
/**
* @var string
*/
private $username;
private $username;

/**
* @var int
Expand Down

0 comments on commit b1d374d

Please sign in to comment.