renatoaraujo/slim-skeleton

View on GitHub
src/Skeleton/Loader/BootstrapLoader.php

Summary

Maintainability
D
1 day
Test Coverage

Function injectDependecy has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
Open

    public function injectDependecy(array $dependencies)
    {
        if (!empty($dependencies)) {
            foreach ($dependencies as $name => $object) {
                if (is_array($object) && !empty($object)) {
Severity: Minor
Found in src/Skeleton/Loader/BootstrapLoader.php - About 1 day 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 injectDependecy has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function injectDependecy(array $dependencies)
    {
        if (!empty($dependencies)) {
            foreach ($dependencies as $name => $object) {
                if (is_array($object) && !empty($object)) {
Severity: Minor
Found in src/Skeleton/Loader/BootstrapLoader.php - About 1 hr to fix

    Method validateCallback has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function validateCallback($callback, $name)
        {
            if (!$callback && !(is_string($callback) && emtpy($callback))) {
                throw new SkeletonException("Error: Callback need to be declared in route {$name}");
            }
    Severity: Minor
    Found in src/Skeleton/Loader/BootstrapLoader.php - About 1 hr to fix

      Function validateCallback has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function validateCallback($callback, $name)
          {
              if (!$callback && !(is_string($callback) && emtpy($callback))) {
                  throw new SkeletonException("Error: Callback need to be declared in route {$name}");
              }
      Severity: Minor
      Found in src/Skeleton/Loader/BootstrapLoader.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 validateRoute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function validateRoute($name, $route)
          {
              $arr_route = [];
      
              if (!array_key_exists('method', $route)) {
      Severity: Minor
      Found in src/Skeleton/Loader/BootstrapLoader.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

      There are no issues that match your filters.

      Category
      Status