Apply fixes from StyleCI (#1194)

This commit is contained in:
Phan An 2020-03-10 11:16:55 +01:00 committed by GitHub
parent d487727fd5
commit 8f142eb03b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 6 deletions

View file

@ -249,7 +249,8 @@ class FileSynchronizer
{
// As directory scanning can be expensive, we cache and reuse the result.
return $this->cache->remember(md5($this->filePath.'_cover'), 24 * 60, function (): ?string {
$matches = array_keys(iterator_to_array(
$matches = array_keys(
iterator_to_array(
$this->finder->create()
->depth(0)
->ignoreUnreadableDirs()
@ -257,7 +258,7 @@ class FileSynchronizer
->followLinks()
->name('/(cov|fold)er\.(jpe?g|png)$/i')
->in(dirname($this->filePath))
)
)
);
$cover = $matches ? $matches[0] : null;

View file

@ -90,12 +90,13 @@ class InteractionService
->whereIn('song_id', $songIds)
->where('user_id', $user->id)
->get()
->each(static function (Interaction $interaction): void {
->each(
static function (Interaction $interaction): void {
$interaction->liked = false;
$interaction->save();
event(new SongLikeToggled($interaction));
}
);
);
}
}

View file

@ -47,7 +47,8 @@ class YouTubeService extends AbstractApiClient implements ApiConsumerInterface
return null;
}
$uri = sprintf('search?part=snippet&type=video&maxResults=%s&pageToken=%s&q=%s',
$uri = sprintf(
'search?part=snippet&type=video&maxResults=%s&pageToken=%s&q=%s',
$perPage,
urlencode($pageToken),
urlencode($q)

View file

@ -24,7 +24,9 @@ class iTunesService extends AbstractApiClient implements ApiConsumerInterface
public function getTrackUrl(string $term, string $album = '', string $artist = ''): ?string
{
try {
return $this->cache->remember(md5("itunes_track_url_{$term}{$album}{$artist}"), 24 * 60 * 7,
return $this->cache->remember(
md5("itunes_track_url_{$term}{$album}{$artist}"),
24 * 60 * 7,
function () use ($term, $album, $artist): ?string {
$params = [
'term' => $term.($album ? " $album" : '').($artist ? " $artist" : ''),