File MediaController.php
has 339 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace App\Controllers;
use App\Database\Repositories\UserRepository;
Method show
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function show(
Request $request,
Response $response,
string $userCode,
string $mediaCode,
Function show
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function show(
Request $request,
Response $response,
string $userCode,
string $mediaCode,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method streamMedia
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function streamMedia(
Request $request,
Response $response,
Filesystem $storage,
$media,
Method handlePartialRequest
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function handlePartialRequest(
Response $response,
Stream $stream,
string $range,
string $disposition,
Consider simplifying this complex logical expression. Open
if (
UA::isBot($userAgent) &&
!(
// embed if enabled
(UA::embedsLinks($userAgent) &&
Function deleteByToken
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function deleteByToken(
Request $request,
Response $response,
string $userCode,
string $mediaCode,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function streamMedia
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function streamMedia(
Request $request,
Response $response,
Filesystem $storage,
$media,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"