S3Streamer::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
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 4
ccs 3
cts 3
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace App\Services\Streamers;
4
5
use App\Services\S3Service;
6
7
class S3Streamer extends Streamer implements ObjectStorageStreamerInterface
8
{
9
    private $s3Service;
10
11 11
    public function __construct(S3Service $s3Service)
12
    {
13 11
        parent::__construct();
14 11
        $this->s3Service = $s3Service;
15 11
    }
16
17
    /**
18
     * Stream the current song through S3.
19
     * Actually, we just redirect the request to the S3 object's location.
20
     */
21
    public function stream()
22
    {
23
        // Get and redirect to the actual presigned-url
24
        return redirect($this->s3Service->getSongPublicUrl($this->song));
0 ignored issues
show
Bug introduced by
It seems like $this->song can also be of type string; however, parameter $song of App\Services\S3Service::getSongPublicUrl() does only seem to accept App\Models\Song, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

24
        return redirect($this->s3Service->getSongPublicUrl(/** @scrutinizer ignore-type */ $this->song));
Loading history...
25
    }
26
}
27