YouTubeController::searchVideosRelatedToSong()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
namespace App\Http\Controllers\API;
4
5
use App\Http\Requests\API\YouTubeSearchRequest;
6
use App\Models\Song;
7
use App\Services\YouTubeService;
8
use Illuminate\Http\JsonResponse;
9
10
/**
11
 * @group YouTube integration
12
 */
13
class YouTubeController extends Controller
14
{
15
    private $youTubeService;
16
17 1
    public function __construct(YouTubeService $youTubeService)
18
    {
19 1
        $this->youTubeService = $youTubeService;
20 1
    }
21
22
    /**
23
     * Search for YouTube videos.
24
     *
25
     * Search YouTube for videos related to a song (using its title and artist name).
26
     *
27
     * @bodyParam pageToken string The [`nextPageToken`](https://developers.google.com/youtube/v3/guides/implementation/pagination), if applicable.
28
     * @responseFile responses/youTube.searchVideosRelatedToSong.json
29
     *
30
     * @return JsonResponse
31
     */
32 1
    public function searchVideosRelatedToSong(YouTubeSearchRequest $request, Song $song)
33
    {
34 1
        return response()->json($this->youTubeService->searchVideosRelatedToSong($song, $request->pageToken));
35
    }
36
}
37