Skip to content

Commit

Permalink
Applied fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
phanan authored and StyleCIBot committed Dec 21, 2015
1 parent 8495452 commit 54c9a88
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 21 deletions.
4 changes: 1 addition & 3 deletions app/Events/SongLikeToggled.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

namespace App\Events;

use App\Events\Event;
use App\Models\Interaction;
use App\Models\User;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;

class SongLikeToggled extends Event
{
Expand All @@ -30,7 +28,7 @@ class SongLikeToggled extends Event
* Create a new event instance.
*
* @param Interaction $interaction
* @param User $user
* @param User $user
*
* @return void
*/
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/API/LastfmController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class LastfmController extends Controller
/**
* Construct the controller and inject the current auth.
*
* @param Guard $auth
* @param Guard $auth
*/
public function __construct(Guard $auth)
{
Expand Down
19 changes: 9 additions & 10 deletions app/Models/Interaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use App\Events\SongLikeToggled;
use App\Traits\CanFilterByUser;
use DB;
use Illuminate\Database\Eloquent\Model;

/**
Expand Down Expand Up @@ -37,8 +36,8 @@ public function song()
/**
* Increase the number of times a song is played by a user.
*
* @param string $songId
* @param User $user
* @param string $songId
* @param User $user
*
* @return Interaction
*/
Expand All @@ -62,8 +61,8 @@ public static function increasePlayCount($songId, User $user)
/**
* Like or unlike a song on behalf of a user.
*
* @param string $songId
* @param User $user
* @param string $songId
* @param User $user
*
* @return Interaction
*/
Expand All @@ -89,8 +88,8 @@ public static function toggleLike($songId, User $user)
/**
* Like several songs at once.
*
* @param array $songIds
* @param User $user
* @param array $songIds
* @param User $user
*
* @return array
*/
Expand Down Expand Up @@ -122,14 +121,14 @@ public static function batchLike(array $songIds, User $user)
/**
* Unlike several songs at once.
*
* @param array $songIds
* @param User $user
* @param array $songIds
* @param User $user
*
* @return int
*/
public static function batchUnlike(array $songIds, User $user)
{
foreach(self::whereIn('song_id', $songIds)->whereUserId($user->id)->get() as $interaction) {
foreach (self::whereIn('song_id', $songIds)->whereUserId($user->id)->get() as $interaction) {
$interaction->liked = false;
$interaction->save();

Expand Down
2 changes: 1 addition & 1 deletion app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function deletePreference($key)
*/
public function connectedToLastfm()
{
return !!$this->getLastfmSessionKey();
return (bool) $this->getLastfmSessionKey();
}

/**
Expand Down
8 changes: 4 additions & 4 deletions app/Services/Lastfm.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,10 @@ public function scrobble($artist, $track, $timestamp, $album, $sk)
/**
* Love or unlove a track on Last.fm.
*
* @param string $track The track name
* @param string $artist The artist's name
* @param string $sk The session key
* @param boolean $love Whether to love or unlove. Such cheesy terms... urrgggh
* @param string $track The track name
* @param string $artist The artist's name
* @param string $sk The session key
* @param bool $love Whether to love or unlove. Such cheesy terms... urrgggh
*
* @return bool
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/InteractionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function testLikeRegister()
public function testBatchLikeAndUnlike()
{
$this->expectsEvents(SongLikeToggled::class);

$user = factory(User::class)->create();

$songs = Song::orderBy('id')->take(2)->get();
Expand Down
1 change: 0 additions & 1 deletion tests/LastfmTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php

use App\Events\SongLikeToggled;
use App\Http\Controllers\API\InteractionController;
use App\Http\Controllers\API\LastfmController;
use App\Listeners\LoveTrackOnLastfm;
use App\Models\Interaction;
Expand Down

0 comments on commit 54c9a88

Please sign in to comment.