Dhii/callback-abstract

View on GitHub

Showing 5 of 50 total issues

Method _invokeCallable has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function _invokeCallable($callable, $args)
    {
        if (!is_callable($callable)) {
            throw $this->_createInvalidArgumentException($this->__('Callable is not callable'), null, null, $callable);
        }
Severity: Minor
Found in src/InvokeCallableCapableTrait.php - About 1 hr to fix

    Function _invokeCallable has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function _invokeCallable($callable, $args)
        {
            if (!is_callable($callable)) {
                throw $this->_createInvalidArgumentException($this->__('Callable is not callable'), null, null, $callable);
            }
    Severity: Minor
    Found in src/InvokeCallableCapableTrait.php - About 45 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

    Method _createValidationFailedException has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            $message = null,
            $code = null,
            RootException $previous = null,
            ValidatorInterface $validator = null,
            $subject = null,
    Severity: Minor
    Found in src/ValidateParamsCapableTrait.php - About 45 mins to fix

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

          public function _normalizeCallable($callable)
          {
              // Closure remains as such
              if ($callable instanceof Closure) {
                  return $callable;
      Severity: Minor
      Found in src/NormalizeCallableCapableTrait.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 _normalizeMethodCallable has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function _normalizeMethodCallable($callable)
          {
              if (is_object($callable) && is_callable($callable)) {
                  return array($callable, '__invoke');
              }
      Severity: Minor
      Found in src/NormalizeMethodCallableCapableTrait.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

      Severity
      Category
      Status
      Source
      Language