Showing 29 of 29 total issues
The method processRequest uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$payload['error'] = 'Coordinates not valid';
}
- 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
The method processRequest uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$payload['error'] = 'Ip not valid';
}
- 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
The method processRequest uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
if (strpos($coords, ',') !== false) {
list($lat, $lng) = explode(',', $coords);
} else {
$payload['error'] = 'Coordinates not valid';
- 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
Line exceeds 120 characters; contains 132 characters Open
<p>Test: <a href="<?= url('weather/api/forecast?type=forecast&ip=8.8.8.8') ?>">weather/api/forecast?type=forecast&ip=8.8.8.8</a></p>
- Exclude checks
Line exceeds 120 characters; contains 140 characters Open
"summary": "Molnigt under dagen och m\u00e5ttlig vind som startar under eftermiddagen, forts\u00e4tter fram till kv\u00e4llen.",
- Exclude checks
Line exceeds 120 characters; contains 166 characters Open
<p>Test: <a href="<?= url('weather/api/forecast?type=forecast&coords=56.188784,15.5902514') ?>">weather/api/forecast?type=forecast&coords=56.188784,15.5902514</a></p>
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
"start" => "\n\n\n" . t("Revision history") . " {#revision}\n-------------\n\n<span class=\"revision-history\">\n",
- Exclude checks
Usage of ELSE IF is discouraged; use ELSEIF instead Open
} else if (defined("ANAX_PRODUCTION")) {
- Exclude checks
Usage of ELSE IF is discouraged; use ELSEIF instead Open
} else if (filter_var($ipAddr, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
- Exclude checks