bkdotcom/PHPDebugConsole

View on GitHub
src/Debug/Collector/SoapClient.php

Summary

Maintainability
A
25 mins
Test Coverage
A
93%

Method __doRequest has 5 arguments (exceeds 4 allowed). Consider refactoring.
Wontfix

    public function __doRequest($request, $location, $action, $version, $oneWay = 0)
Severity: Minor
Found in src/Debug/Collector/SoapClient.php - About 35 mins to fix

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

        private function logReqRes($action, $exception = null, $logParsedFault = false)
        {
            \bdk\Debug\Utility::assertType($exception, 'Exception');
    
            $fault = null;
    Severity: Minor
    Found in src/Debug/Collector/SoapClient.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

    Define a constant instead of duplicating this literal "reason" 3 times.
    Open

                        'reason' => $fault->getElementsByTagName('Reason')->item(0)->textContent,
    Severity: Critical
    Found in src/Debug/Collector/SoapClient.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Define a constant instead of duplicating this literal "class" 4 times.
    Open

                    'class' => null,
    Severity: Critical
    Found in src/Debug/Collector/SoapClient.php by sonar-php

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    There are no issues that match your filters.

    Category
    Status