SergioMadness/pwf-helpers

View on GitHub
src/SystemHelpers.php

Summary

Maintainability
A
1 hr
Test Coverage

Function methodDI has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function methodDI(array $objectInfo, \Closure $callback = null)
    {
        $reflection     = new \ReflectionObject($objectInfo[0]);
        $methods        = $reflection->getMethods();
        $inputParams    = [];
Severity: Minor
Found in src/SystemHelpers.php - About 35 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 functionDI has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function functionDI(\Closure $function,
                                      \Closure $callback = null)
    {
        $reflection     = new \ReflectionFunction($function);
        $functionParams = $reflection->getParameters();
Severity: Minor
Found in src/SystemHelpers.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

Missing class import via use statement (line '36', column '31').
Open

        $reflection     = new \ReflectionFunction($function);
Severity: Minor
Found in src/SystemHelpers.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '88', column '20').
Open

        $ref = new \ReflectionClass($className);
Severity: Minor
Found in src/SystemHelpers.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '59', column '31').
Open

        $reflection     = new \ReflectionObject($objectInfo[0]);
Severity: Minor
Found in src/SystemHelpers.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

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

                                      \Closure $callback = null)
Severity: Minor
Found in src/SystemHelpers.php by phpcodesniffer

The first parameter of a multi-line function declaration must be on the line after the opening bracket
Open

    public static function constructObject($className,
Severity: Minor
Found in src/SystemHelpers.php by phpcodesniffer

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

    {
Severity: Minor
Found in src/SystemHelpers.php by phpcodesniffer

Multi-line function declaration not indented correctly; expected 8 spaces but found 43
Open

                                           array $constructorArguments = [])
Severity: Minor
Found in src/SystemHelpers.php by phpcodesniffer

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

    {
Severity: Minor
Found in src/SystemHelpers.php by phpcodesniffer

The first parameter of a multi-line function declaration must be on the line after the opening bracket
Open

    public static function functionDI(\Closure $function,
Severity: Minor
Found in src/SystemHelpers.php by phpcodesniffer

Multi-line function declaration not indented correctly; expected 8 spaces but found 38
Open

                                      \Closure $callback = null)
Severity: Minor
Found in src/SystemHelpers.php by phpcodesniffer

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

                                           array $constructorArguments = [])
Severity: Minor
Found in src/SystemHelpers.php by phpcodesniffer

Expected 1 newline at end of file; 0 found
Open

}
Severity: Minor
Found in src/SystemHelpers.php by phpcodesniffer

There are no issues that match your filters.

Category
Status