propelorm/Propel2

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

Summary

Maintainability
D
1 day
Test Coverage

Function loadDataModels has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    protected function loadDataModels(): void
    {
        $schemas = [];
        $totalNbTables = 0;
        $dataModelFiles = $this->getSchemas();
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 getDatabases has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    public function getDatabases(): array
    {
        if ($this->databases === null) {
            $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

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

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

    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

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

          protected function includeExternalSchemas(DOMDocument $dom, string $srcDir): int
          {
              $databaseNode = $dom->getElementsByTagName('database')->item(0);
              $externalSchemaNodes = $dom->getElementsByTagName('external-schema');
      
      
      Severity: Minor
      Found in src/Propel/Generator/Manager/AbstractManager.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 includeExternalSchemas has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function includeExternalSchemas(DOMDocument $dom, string $srcDir): int
          {
              $databaseNode = $dom->getElementsByTagName('database')->item(0);
              $externalSchemaNodes = $dom->getElementsByTagName('external-schema');
      
      
      Severity: Minor
      Found in src/Propel/Generator/Manager/AbstractManager.php - About 1 hr to fix

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

            protected function getProperties(string $file): array
            {
                $properties = [];
        
                $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