propelorm/Propel2

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

Summary

Maintainability
C
1 day
Test Coverage

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

class MigrationManager extends AbstractManager
{
    /**
     * @var array
     */
Severity: Minor
Found in src/Propel/Generator/Manager/MigrationManager.php - About 2 hrs to fix

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

    <?php
    
    /**
     * 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 2 hrs to fix

      Method getMigrationClassBody has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getMigrationClassBody($migrationsUp, $migrationsDown, $timestamp, $comment = "", $suffix = "")
          {
              $timeInWords = date('Y-m-d H:i:s', $timestamp);
              $migrationAuthor = ($author = $this->getUser()) ? 'by ' . $author : '';
              $migrationClassName = $this->getMigrationClassName($timestamp, $suffix);
      Severity: Minor
      Found in src/Propel/Generator/Manager/MigrationManager.php - About 1 hr to fix

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

            public function getAllDatabaseVersions()
            {
                $connections = $this->getConnections();
                if (!$connections) {
                    throw new \Exception('You must define database connection settings in a buildtime-conf.xml file to use migrations');
        Severity: Minor
        Found in src/Propel/Generator/Manager/MigrationManager.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

        Method getMigrationClassBody has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

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

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

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

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

              public function getMigrationTimestamps()
              {
                  $path = $this->getWorkingDirectory();
                  $migrationTimestamps = [];
          
          
          Severity: Minor
          Found in src/Propel/Generator/Manager/MigrationManager.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