kahlan/kahlan

View on GitHub
src/Plugin/Double.php

Summary

Maintainability
C
1 day
Test Coverage
A
99%

File Double.php has 295 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
namespace Kahlan\Plugin;

use Kahlan\Jit\Parser;
use Kahlan\Jit\Patcher\Pointcut;
Severity: Minor
Found in src/Plugin/Double.php - About 3 hrs to fix

    Method generate has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function generate($options = [])
        {
            $defaults = [
                'class'      => 'Kahlan\Spec\Plugin\Double\Double' . static::$_index++,
                'extends'    => '',
    Severity: Minor
    Found in src/Plugin/Double.php - About 1 hr to fix

      Function _generateMethodStubs has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          protected static function _generateMethodStubs($methods, $defaults = true)
          {
              $result = [];
              $methods = $methods !== null ? (array) $methods : [];
      
      
      Severity: Minor
      Found in src/Plugin/Double.php - About 1 hr 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 instance has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function instance($options = [])
          {
              $class = static::classname($options);
      
              if (isset($options['args'])) {
      Severity: Minor
      Found in src/Plugin/Double.php - About 1 hr 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 _generateSignature has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          protected static function _generateSignature($method)
          {
              $params = [];
              $isVariadic = $method->isVariadic();
      
      
      Severity: Minor
      Found in src/Plugin/Double.php - About 55 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 generate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function generate($options = [])
          {
              $defaults = [
                  'class'      => 'Kahlan\Spec\Plugin\Double\Double' . static::$_index++,
                  'extends'    => '',
      Severity: Minor
      Found in src/Plugin/Double.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 _generateInterfaceMethods has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          protected static function _generateInterfaceMethods($interfaces, $mask = 255)
          {
              if (!$interfaces) {
                  return [];
              }
      Severity: Minor
      Found in src/Plugin/Double.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

      There are no issues that match your filters.

      Category
      Status