renatoaraujo/slim-skeleton

View on GitHub

Showing 9 of 9 total issues

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

SkeletonController has 28 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class SkeletonController implements SkeletonControllerInterface
{
    /**
     * @var ContainerInterface
     */
Severity: Minor
Found in src/Skeleton/Controller/SkeletonController.php - About 3 hrs to fix

    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

      Function getCacheType has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          private function getCacheType($cacheType = '', $useArrayCacheOnDevelopment = true)
          {
      
              if ($useArrayCacheOnDevelopment && $this->isDevelopment) {
                  $cache = new \Doctrine\Common\Cache\ArrayCache();
      Severity: Minor
      Found in src/Skeleton/Service/DoctrineORMService.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

      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

        Method __invoke has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function __invoke(ContainerInterface $ci)
            {
                $settings = $ci->get('settings');
                $this->isDevelopment = $settings['environment']['isDevelopment'];
                $this->configOptions = $settings['doctrine']['config'];
        Severity: Minor
        Found in src/Skeleton/Service/DoctrineORMService.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

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

              protected function getRepositoryEntity($strEntity = null)
              {
                  if (empty($strEntity)) {
                      if (!$this->strEntity) {
                          $this->setRepositoryFromServiceName();
          Severity: Minor
          Found in src/Skeleton/Service/AbstractEntityService.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

          Severity
          Category
          Status
          Source
          Language