File PortfolioController.php
has 465 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
Method storeSettings
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function storeSettings(Request $request)
{
abort_if(!$request->user(), 403);
$this->validate($request, [
Function storeSettings
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function storeSettings(Request $request)
{
abort_if(!$request->user(), 403);
$this->validate($request, [
- 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 getRssFeed
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getRssFeed(Request $request, $username)
{
$user = User::whereUsername($username)->first();
if(!$user) {
Method getAccountSettings
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAccountSettings(Request $request)
{
$this->validate($request, [
'id' => 'required|integer'
]);
Method getSettings
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getSettings(Request $request)
{
abort_if(!$request->user(), 403);
$res = Portfolio::whereUserId($request->user()->id)->get();
Method getApFeed
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getApFeed(Request $request, $username)
{
$user = User::whereUsername($username)->first();
if(!$user) {
Method store
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function store(Request $request)
{
abort_unless($request->user(), 404);
$this->validate($request, [
Function getAccountSettings
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getAccountSettings(Request $request)
{
$this->validate($request, [
'id' => 'required|integer'
]);
- 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 show
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function show(Request $request, $username)
{
$user = User::whereUsername($username)->first();
if(!$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"
Further reading
Avoid too many return
statements within this method. Open
return view('portfolio.show', compact('user', 'portfolio'));
Avoid too many return
statements within this method. Open
return view('portfolio.404');
Function getApFeed
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getApFeed(Request $request, $username)
{
$user = User::whereUsername($username)->first();
if(!$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"