propelorm/Propel2

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

Summary

Maintainability
C
1 day
Test Coverage

Function getDatabases has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    public function getDatabases()
    {
        if (null === $this->databases) {
            $databases = [];
            foreach ($this->getDataModels() as $dataModel) {
Severity: Minor
Found in src/Propel/Generator/Manager/AbstractManager.php - About 3 hrs 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 loadDataModels has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    protected function loadDataModels()
    {
        $schemas = [];
        $totalNbTables   = 0;
        $dataModelFiles  = $this->getSchemas();
Severity: Minor
Found in src/Propel/Generator/Manager/AbstractManager.php - About 2 hrs 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

AbstractManager has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class AbstractManager
{
    /**
     * Data models that we collect. One from each XML schema file.
     */
Severity: Minor
Found in src/Propel/Generator/Manager/AbstractManager.php - About 2 hrs to fix

    Method loadDataModels has 54 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function loadDataModels()
        {
            $schemas = [];
            $totalNbTables   = 0;
            $dataModelFiles  = $this->getSchemas();
    Severity: Major
    Found in src/Propel/Generator/Manager/AbstractManager.php - About 2 hrs to fix

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

          protected function includeExternalSchemas(\DOMDocument $dom, $srcDir)
          {
              $databaseNode = $dom->getElementsByTagName('database')->item(0);
              $externalSchemaNodes = $dom->getElementsByTagName('external-schema');
      
      
      Severity: Minor
      Found in src/Propel/Generator/Manager/AbstractManager.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 getProperties has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function getProperties($file)
          {
              $properties = [];
      
              if (false === $lines = @file($file)) {
      Severity: Minor
      Found in src/Propel/Generator/Manager/AbstractManager.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