propelorm/Propel2

View on GitHub
src/Propel/Generator/Manager/MigrationManager.php

Summary

Maintainability
D
1 day
Test Coverage

File MigrationManager.php has 399 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * MIT License. This file is part of the Propel package.
 * For the full copyright and license information, please view the LICENSE
Severity: Minor
Found in src/Propel/Generator/Manager/MigrationManager.php - About 5 hrs to fix

    MigrationManager has 34 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class MigrationManager extends AbstractManager
    {
        use PathTrait;
    
        /**
    Severity: Minor
    Found in src/Propel/Generator/Manager/MigrationManager.php - About 4 hrs to fix

      Function buildConnectionToVariableNameMap has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          protected static function buildConnectionToVariableNameMap(array $migrationsUp, array $migrationsDown): array
          {
              $connectionToVariableName = [];
              foreach ([$migrationsUp, $migrationsDown] as $migrations) {
                  $connectionNames = array_keys($migrations);
      Severity: Minor
      Found in src/Propel/Generator/Manager/MigrationManager.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 getMigrationTimestamps has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getMigrationTimestamps(): array
          {
              $path = $this->getWorkingDirectory();
              $migrationTimestamps = [];
      
      
      Severity: Minor
      Found in src/Propel/Generator/Manager/MigrationManager.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 getMigrationClassBody has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function getMigrationClassBody(array $migrationsUp, array $migrationsDown, int $timestamp, string $comment = '', string $suffix = ''): string
      Severity: Minor
      Found in src/Propel/Generator/Manager/MigrationManager.php - About 35 mins to fix

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

            public function findMigrationClassNameSuffix(int $timestamp): string
            {
                $suffix = '';
                $path = $this->getWorkingDirectory();
                if ($path && is_dir($path)) {
        Severity: Minor
        Found in src/Propel/Generator/Manager/MigrationManager.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

        There are no issues that match your filters.

        Category
        Status