RecentlyPlayedController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A index() 0 3 1
A __construct() 0 4 1
1
<?php
2
3
namespace App\Http\Controllers\API\Interaction;
4
5
use App\Repositories\InteractionRepository;
6
use App\Services\InteractionService;
7
use Illuminate\Http\Request;
8
9
/**
10
 * @group 3. Song interactions
11
 */
12
class RecentlyPlayedController extends Controller
13
{
14
    private $interactionRepository;
15
16
    public function __construct(InteractionService $interactionService, InteractionRepository $interactionRepository)
17
    {
18
        parent::__construct($interactionService);
19
        $this->interactionRepository = $interactionRepository;
20
    }
21
22
    /**
23
     * Get recently played songs.
24
     *
25
     * Get a list of songs recently played by the current user.
26
     *
27
     * @queryParam count The maximum number of songs to be returned. Example: 2
28
     * @response ["0146d01afb742b01f28ab8b556f9a75d", "c741133cb8d1982a5c60b1ce2a1e6e47"]
29
     */
30
    public function index(Request $request, ?int $count = null)
31
    {
32
        return response()->json($this->interactionRepository->getRecentlyPlayed($request->user(), $count));
33
    }
34
}
35