BatchLikeController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A destroy() 0 5 1
A store() 0 5 1
1
<?php
2
3
namespace App\Http\Controllers\API\Interaction;
4
5
use App\Http\Requests\API\BatchInteractionRequest;
6
7
/**
8
 * @group 3. Song interactions
9
 */
10
class BatchLikeController extends Controller
11
{
12
    /**
13
     * Like multiple songs.
14
     *
15
     * Like several songs at once, useful for "batch" actions. An array of "interaction" records containing the song
16
     * and user data will be returned.
17
     *
18
     * @bodyParam songs array required An array of song IDs.
19
     * @responseFile responses/interactions.json
20
     */
21 1
    public function store(BatchInteractionRequest $request)
22
    {
23 1
        $interactions = $this->interactionService->batchLike((array) $request->songs, $request->user());
24
25 1
        return response()->json($interactions);
26
    }
27
28
    /**
29
     * Unlike multiple songs.
30
     *
31
     * Unlike several songs at once, useful for "batch" actions. An array of "interaction" records containing the song
32
     * and user data will be returned.
33
     *
34
     * @bodyParam songs array required An array of song IDs.
35
     * @responseFile responses/interactions.json
36
     */
37 1
    public function destroy(BatchInteractionRequest $request)
38
    {
39 1
        $this->interactionService->batchUnlike((array) $request->songs, $request->user());
40
41 1
        return response()->json();
42
    }
43
}
44