librenms/librenms

View on GitHub
LibreNMS/Util/Laravel.php

Summary

Maintainability
A
0 mins
Test Coverage

isCli accesses the super-global variable $_SERVER.
Open

    public static function isCli(): bool
    {
        return Laravel::isBooted()
            ? App::runningInConsole()
            : (php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR']));
Severity: Minor
Found in LibreNMS/Util/Laravel.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

The method bootWeb has a boolean flag argument $authenticate, which is a certain sign of a Single Responsibility Principle violation.
Open

    public static function bootWeb($authenticate = false)
Severity: Minor
Found in LibreNMS/Util/Laravel.php by phpmd

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

Avoid unused local variables such as '$response'.
Open

        $response = $kernel->handle($request);
Severity: Minor
Found in LibreNMS/Util/Laravel.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

There are no issues that match your filters.

Category
Status