vairogs/vairogs

View on GitHub

Showing 98 of 98 total issues

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

        bool $int = true,

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 method makeOneDimension has a boolean flag argument $onlyLast, which is a certain sign of a Single Responsibility Principle violation.
Open

        bool $onlyLast = 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 method distanceBetweenPoints has a boolean flag argument $km, which is a certain sign of a Single Responsibility Principle violation.
Open

        bool $km = true,

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 method snakeCaseFromSentence has a boolean flag argument $skipCamel, which is a certain sign of a Single Responsibility Principle violation.
Open

        bool $skipCamel = 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 method makeOneDimension has a boolean flag argument $allowList, which is a certain sign of a Single Responsibility Principle violation.
Open

        bool $allowList = 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 method getenv has a boolean flag argument $localOnly, which is a certain sign of a Single Responsibility Principle violation.
Open

        bool $localOnly = true,

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 too many return statements within this method.
Open

        return false;
Severity: Major
Found in src/Vairogs/Component/Functions/Local/_WillBeAvailable.php - About 30 mins to fix

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

            bool $trust = 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 method format has a boolean flag argument $asArray, which is a certain sign of a Single Responsibility Principle violation.
    Open

            bool $asArray = 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 method isAssociative has a boolean flag argument $allowList, which is a certain sign of a Single Responsibility Principle violation.
    Open

            bool $allowList = 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 method isPrimeGmp has a boolean flag argument $override, which is a certain sign of a Single Responsibility Principle violation.
    Open

            bool $override = 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 method get has a boolean flag argument $throwOnUnInitialized, which is a certain sign of a Single Responsibility Principle violation.
    Open

            bool $throwOnUnInitialized = 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

    Function parseHeaders has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function parseHeaders(
            string $rawHeaders = '',
        ): array {
            $headers = [];
            $headerArray = str_replace(search: '\\r', replace: '', subject: $rawHeaders);
    Severity: Minor
    Found in src/Vairogs/Component/Functions/Web/_ParseHeaders.php - About 25 mins to fix

    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 isInstalled has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function isInstalled(
            array $packages,
            bool $incDevReq = false,
        ): bool {
            foreach ($packages as $packageName) {
    Severity: Minor
    Found in src/Vairogs/Component/Functions/Local/_IsInstalled.php - About 25 mins to fix

    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 format has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function format(
            int|float $timestamp,
            bool $asArray = false,
        ): array|string {
            $timestamp = round(num: $timestamp * 1000);
    Severity: Minor
    Found in src/Vairogs/Component/Functions/Date/_TimeFormat.php - About 25 mins to fix

    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 unpack has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function unpack(
            array $oneDimension,
        ): array {
            $multiDimension = [];
    
    
    Severity: Minor
    Found in src/Vairogs/Component/Functions/Iteration/_Unpack.php - About 25 mins to fix

    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 filteredMethods has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function filteredMethods(string $class, ?string $filterClass = null): array
        {
            try {
                $methods = (new ReflectionClass(objectOrClass: $class))->getMethods(filter: ReflectionMethod::IS_PUBLIC);
            } catch (Exception) {
    Severity: Minor
    Found in src/Vairogs/Component/Functions/Php/_FilteredMethods.php - About 25 mins to fix

    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

    Avoid using static access to class '\Composer\InstalledVersions' in method 'willBeAvailable'.
    Open

    }

    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 '\Composer\InstalledVersions' in method 'willBeAvailable'.
    Open

            if (!InstalledVersions::isInstalled(packageName: $package) || InstalledVersions::isInstalled(packageName: $package, includeDevRequirements: false)) {

    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 '\Composer\InstalledVersions' in method 'willBeAvailable'.
    Open

                if ($rootPackage === $parentPackage || (InstalledVersions::isInstalled(packageName: $parentPackage) && !InstalledVersions::isInstalled(packageName: $parentPackage, includeDevRequirements: false))) {

    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

    Severity
    Category
    Status
    Source
    Language