Conditions | 6 |
Paths | 16 |
Total Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 42 |
Changes | 0 |
1 | <?php |
||
18 | public function stream() |
||
19 | { |
||
20 | try { |
||
21 | $rangeSet = RangeSet::createFromHeader(get_request_header('Range')); |
||
22 | /** @var resource $resource */ |
||
23 | $resource = new FileResource($this->song->path, 'application/octet-stream'); |
||
24 | (new ResourceServlet($resource))->sendResource($rangeSet); |
||
|
|||
25 | } catch (InvalidRangeHeaderException $e) { |
||
26 | abort(400); |
||
27 | } catch (UnsatisfiableRangeException $e) { |
||
28 | abort(416); |
||
29 | } catch (NonExistentFileException $e) { |
||
30 | abort(404); |
||
31 | } catch (UnreadableFileException $e) { |
||
32 | abort(500); |
||
33 | } catch (SendFileFailureException $e) { |
||
34 | abort_unless(headers_sent(), 500); |
||
35 | echo "An error occurred while attempting to send the requested resource: {$e->getMessage()}"; |
||
36 | } |
||
37 | |||
38 | exit; |
||
39 | } |
||
40 | } |
||
41 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: