FavoritesController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A show() 0 5 1
1
<?php
2
3
namespace App\Http\Controllers\API\Download;
4
5
use App\Http\Requests\API\Download\Request;
6
use App\Repositories\InteractionRepository;
7
use App\Services\DownloadService;
8
9
/**
10
 * @group 6. Download
11
 */
12
class FavoritesController extends Controller
13
{
14
    private $interactionRepository;
15
16 1
    public function __construct(DownloadService $downloadService, InteractionRepository $interactionRepository)
17
    {
18 1
        parent::__construct($downloadService);
19 1
        $this->interactionRepository = $interactionRepository;
20 1
    }
21
22
    /**
23
     * Download all songs favorite'd by the current user.
24
     *
25
     * @response []
26
     */
27 1
    public function show(Request $request)
28
    {
29 1
        $songs = $this->interactionRepository->getUserFavorites($request->user());
30
31 1
        return response()->download($this->downloadService->from($songs));
32
    }
33
}
34