Showing 479 of 479 total issues
Avoid too many return
statements within this method. Open
return $row->station->name ?: ($row->structure->name ?: $row->container->name);
Avoid too many return
statements within this method. Open
return $type->marketGroupID == Moon::EXCEPTIONAL;
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this method. Open
return $query->whereRaw('character_assets.name LIKE ?', ["%$search%"]);
Avoid too many return
statements within this method. Open
return $collection->when($collection->isNotEmpty(), function ($ids) {
return $this->resolveInternalAllianceIDs($ids);
});
Avoid too many return
statements within this method. Open
return $table->make(true);
Avoid too many return
statements within this method. Open
return $this->moon_indicators ?: (object) [
'ubiquitous' => 0,
'common' => 0,
'uncommon' => 0,
'rare' => 0,
Avoid too many return
statements within this method. Open
return ! in_array($type->marketGroupID, [Moon::UBIQUITOUS, Moon::COMMON, Moon::UNCOMMON, Moon::RARE, Moon::EXCEPTIONAL]);
Avoid too many return
statements within this method. Open
return $collection->when($collection->isNotEmpty(), function ($ids) {
return $this->resolveInternalCorporationIDs($ids);
});
Avoid too many return
statements within this method. Open
return response()->json($this->response);
The method load_plugin_menu has a boolean flag argument $require_affiliation, which is a certain sign of a Single Responsibility Principle violation. Open
public function load_plugin_menu(string $package_name, array $menu_data, bool $require_affiliation = false): ?array
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Function compose
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function compose(View $view)
{
// This menu item declares the menu and
// sets it as an array of arrays.
- 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 compose
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function compose(View $view)
{
// This menu item declares the menu and
// sets it as an array of arrays.
- 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 redirectToProvider
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function redirectToProvider($profile = null, Socialite $social)
{
$scopes_setting = collect(setting('sso_scopes', true));
- 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 compose
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function compose(View $view)
{
// This menu item declares the menu and
// sets it as an array of arrays.
- 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
The method checkLoginToken uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
session()->push('user_sharing', $token->character_id);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid unused private methods such as 'getEveSkillsGroups'. Open
private function getEveSkillsGroups()
{
$groups = InvGroup::where('categoryID', 16)
->where('groupID', '<>', 505)
- Read upRead up
- Exclude checks
UnusedPrivateMethod
Since: 0.2
Unused Private Method detects when a private method is declared but is unused.
Example
class Something
{
private function foo() {} // unused
}
Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod
Avoid unused parameters such as '$squad'. Open
public function manage_roles(User $user, Squad $squad)
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Avoid unused parameters such as '$key'. Open
->map(function ($alliance, $key) {
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Avoid unused parameters such as '$request'. Open
public function getSearchCharacterAssetsData(Request $request)
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}