librenms/librenms

View on GitHub
LibreNMS/Data/Source/FpingResponse.php

Summary

Maintainability
A
0 mins
Test Coverage

The method __construct has 10 parameters. Consider reducing the number of parameters to less than 10.
Open

    private function __construct(
        public readonly int $transmitted,
        public readonly int $received,
        public readonly int $loss,
        public readonly float $min_latency,

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

        private bool $skipped = false)

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

The closing parenthesis and the opening brace of a multi-line function declaration must be on the same line
Open

    {

Scope keyword "static" must be followed by a single space
Open

    public static function artificialUp(string $host = null): static

The closing parenthesis of a multi-line function declaration must be on a new line
Open

        private bool $skipped = false)

Scope keyword "static" must be followed by a single space
Open

    public static function artificialDown(string $host = null): static

Line indented incorrectly; expected 4 spaces, found 8
Open

        public readonly int $transmitted,

Line indented incorrectly; expected 4 spaces, found 8
Open

        public readonly int $duplicates,

Line indented incorrectly; expected 4 spaces, found 8
Open

        public int $exit_code,

Line indented incorrectly; expected 4 spaces, found 8
Open

        public readonly float $min_latency,

Line indented incorrectly; expected 4 spaces, found 8
Open

        private bool $skipped = false)

Line indented incorrectly; expected 4 spaces, found 8
Open

        public readonly ?string $host = null,

Line indented incorrectly; expected 4 spaces, found 8
Open

        public readonly float $avg_latency,

Line indented incorrectly; expected 4 spaces, found 8
Open

        public readonly int $received,

Line indented incorrectly; expected 4 spaces, found 8
Open

        public readonly int $loss,

Line indented incorrectly; expected 4 spaces, found 8
Open

        public readonly float $max_latency,

There are no issues that match your filters.

Category
Status