File ProfileController.php
has 314 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace App\Http\Controllers;
use App\AccountInterstitial;
Method showAtomFeed
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function showAtomFeed(Request $request, $user)
{
abort_if(! config('federation.atom.enabled'), 404);
$pid = AccountService::usernameToId($user);
Method buildProfile
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function buildProfile(Request $request, $user)
{
$username = $user->username;
$loggedIn = Auth::check();
$isPrivate = false;
Function show
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function show(Request $request, $username)
{
if ($request->wantsJson() && (bool) config_cache('federation.activitypub.enabled')) {
$user = $this->getCachedUser($username, true);
abort_if(! $user, 404, 'Not found');
- 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 buildProfile
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function buildProfile(Request $request, $user)
{
$username = $user->username;
$loggedIn = Auth::check();
$isPrivate = false;
- 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 embed
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function embed(Request $request, $username)
{
$res = view('profile.embed-removed');
if (! (bool) config_cache('instance.embed.profile')) {
Method show
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function show(Request $request, $username)
{
if ($request->wantsJson() && (bool) config_cache('federation.activitypub.enabled')) {
$user = $this->getCachedUser($username, true);
abort_if(! $user, 404, 'Not found');
Function embed
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function embed(Request $request, $username)
{
$res = view('profile.embed-removed');
if (! (bool) config_cache('instance.embed.profile')) {
- 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
Avoid too many return
statements within this method. Open
return response($res)->withHeaders(['X-Frame-Options' => 'ALLOWALL']);
Avoid too many return
statements within this method. Open
return view('profile.show', compact('profile', 'settings'));
Avoid too many return
statements within this method. Open
return response($res)->withHeaders(['X-Frame-Options' => 'ALLOWALL']);
Avoid too many return
statements within this method. Open
return $settings->show_atom;
Avoid too many return
statements within this method. Open
return StatusService::get($status->id, true);
Avoid too many return
statements within this method. Open
return response()
->view('atom.user',
[
'profile' => $profile,
'items' => $data['items'],
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return response($res)->withHeaders(['X-Frame-Options' => 'ALLOWALL']);
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return redirect('/login');
Avoid too many return
statements within this method. Open
return compact('items', 'permalink', 'headers');
Avoid too many return
statements within this method. Open
return $this->buildProfile($request, $user);
Avoid too many return
statements within this method. Open
return view('profile.private', compact('user', 'is_following', 'requested'));
Avoid too many return
statements within this method. Open
return $status &&
isset($status['account']) &&
isset($status['media_attachments']) &&
count($status['media_attachments']);
Function showAtomFeed
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function showAtomFeed(Request $request, $user)
{
abort_if(! config('federation.atom.enabled'), 404);
$pid = AccountService::usernameToId($user);
- 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"