Skip to content

Commit

Permalink
Apply fixes from StyleCI (#1194)
Browse files Browse the repository at this point in the history
  • Loading branch information
phanan committed Mar 10, 2020
1 parent d487727 commit 8f142eb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
5 changes: 3 additions & 2 deletions app/Services/FileSynchronizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,16 @@ private function getCoverFileUnderSameDirectory(): ?string
{
// 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()
->files()
->followLinks()
->name('/(cov|fold)er\.(jpe?g|png)$/i')
->in(dirname($this->filePath))
)
)
);

$cover = $matches ? $matches[0] : null;
Expand Down
5 changes: 3 additions & 2 deletions app/Services/InteractionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,13 @@ public function batchUnlike(array $songIds, User $user): void
->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));
}
);
);
}
}
3 changes: 2 additions & 1 deletion app/Services/YouTubeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ public function search(string $q, string $pageToken = '', int $perPage = 10)
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)
Expand Down
4 changes: 3 additions & 1 deletion app/Services/iTunesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ public function used(): bool
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" : ''),
Expand Down

0 comments on commit 8f142eb

Please sign in to comment.