LikeController   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 2
c 0
b 0
f 0
dl 0
loc 16
ccs 2
cts 2
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A store() 0 3 1
1
<?php
2
3
namespace App\Http\Controllers\API\Interaction;
4
5
use App\Http\Requests\API\SongLikeRequest;
6
use Illuminate\Http\JsonResponse;
7
8
/**
9
 * @group 3. Song interactions
10
 */
11
class LikeController extends Controller
12
{
13
    /**
14
     * Like or unlike a song.
15
     *
16
     * An "interaction" record including the song and current user's data will be returned.
17
     *
18
     * @bodyParam song string required The ID of the song. Example: 0146d01afb742b01f28ab8b556f9a75d
19
     *
20
     * @responseFile responses/interaction.json
21
     *
22
     * @return JsonResponse
23
     */
24 1
    public function store(SongLikeRequest $request)
25
    {
26 1
        return response()->json($this->interactionService->toggleLike($request->song, $request->user()));
27
    }
28
}
29