SergiX44/XBackBone

View on GitHub
app/helpers.php

Summary

Maintainability
A
2 hrs
Test Coverage

File helpers.php has 301 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

<?php

use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\Factory\ServerRequestCreatorFactory;
Severity: Minor
Found in app/helpers.php - About 3 hrs to fix

    Method mime2font has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function mime2font($mime)
        {
            $classes = [
                'image' => 'fa-file-image',
                'audio' => 'fa-file-audio',
    Severity: Minor
    Found in app/helpers.php - About 1 hr to fix

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

          function dsnFromConfig(array $config): string
          {
              $dsn = $config['db']['dsn'];
              if ($config['db']['connection'] === 'sqlite') {
                  if (getcwd() !== BASE_DIR) { // if in installer, change the working dir to the app dir
      Severity: Minor
      Found in app/helpers.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 cleanDirectory has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          function cleanDirectory($path, $all = false)
          {
              $directoryIterator = new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS);
              $iteratorIterator = new RecursiveIteratorIterator($directoryIterator, RecursiveIteratorIterator::CHILD_FIRST);
              foreach ($iteratorIterator as $file) {
      Severity: Minor
      Found in app/helpers.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