S3Streamer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
wmc 2
eloc 5
c 0
b 0
f 0
dl 0
loc 18
ccs 4
cts 6
cp 0.6667
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A stream() 0 4 1
A __construct() 0 4 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