autowp/autowp

View on GitHub
module/Traffic/src/TrafficControl.php

Summary

Maintainability
A
0 mins
Test Coverage
F
42%

Avoid using static access to class '\Laminas\Json\Json' in method 'getBanInfo'.
Open

        return Json::decode($response->getBody(), Json::TYPE_ARRAY);
Severity: Minor
Found in module/Traffic/src/TrafficControl.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\Laminas\Json\Json' in method 'pushHit'.
Open

        $this->rabbitmq->send('input', Json::encode([
            'ip'        => $ip,
            'timestamp' => (new DateTime())->format(DateTime::RFC3339),
        ]));
Severity: Minor
Found in module/Traffic/src/TrafficControl.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

syntax error, unexpected 'RabbitMQ' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)
Open

    private RabbitMQ $rabbitmq;
Severity: Critical
Found in module/Traffic/src/TrafficControl.php by phan

There are no issues that match your filters.

Category
Status