FavoritesController::show()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
cc 1
nc 1
nop 1
crap 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