propelorm/Propel2

View on GitHub
src/Propel/Generator/Behavior/Delegate/DelegateBehavior.php

Summary

Maintainability
C
1 day
Test Coverage

Function isColumnForeignKeyOrDuplicated has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    protected function isColumnForeignKeyOrDuplicated(Column $column): bool
    {
        $delegateTable = $column->getTable();
        $table = $this->getTable();
        $fks = [];
Severity: Minor
Found in src/Propel/Generator/Behavior/Delegate/DelegateBehavior.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

Function modifyTable has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function modifyTable(): void
    {
        $table = $this->getTable();
        $database = $table->getDatabase();
        $delegates = explode(',', $this->parameters['to']);
Severity: Minor
Found in src/Propel/Generator/Behavior/Delegate/DelegateBehavior.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 modifyTable has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function modifyTable(): void
    {
        $table = $this->getTable();
        $database = $table->getDatabase();
        $delegates = explode(',', $this->parameters['to']);
Severity: Minor
Found in src/Propel/Generator/Behavior/Delegate/DelegateBehavior.php - About 1 hr to fix

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

        protected function isColumnForeignKeyOrDuplicated(Column $column): bool
        {
            $delegateTable = $column->getTable();
            $table = $this->getTable();
            $fks = [];
    Severity: Minor
    Found in src/Propel/Generator/Behavior/Delegate/DelegateBehavior.php - About 1 hr to fix

      Method queryMethods has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function queryMethods(QueryBuilder $builder): string
          {
              $script = '';
      
              foreach ($this->delegates as $delegate => $type) {
      Severity: Minor
      Found in src/Propel/Generator/Behavior/Delegate/DelegateBehavior.php - About 1 hr to fix

        Method objectCall has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function objectCall(ObjectBuilder $builder): string
            {
                $script = '';
                foreach ($this->delegates as $delegate => $type) {
                    $delegateTable = $this->getDelegateTable($delegate);
        Severity: Minor
        Found in src/Propel/Generator/Behavior/Delegate/DelegateBehavior.php - About 1 hr to fix

          Method objectFilter has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function objectFilter(string &$script): void
              {
                  $p = new PhpParser($script, true);
                  $text = (string)$p->findMethod('toArray');
                  $matches = [];
          Severity: Minor
          Found in src/Propel/Generator/Behavior/Delegate/DelegateBehavior.php - About 1 hr to fix

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

                public function queryAttributes(): string
                {
                    $script = '';
                    $collations = '';
            
            
            Severity: Minor
            Found in src/Propel/Generator/Behavior/Delegate/DelegateBehavior.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

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

                public function objectFilter(string &$script): void
                {
                    $p = new PhpParser($script, true);
                    $text = (string)$p->findMethod('toArray');
                    $matches = [];
            Severity: Minor
            Found in src/Propel/Generator/Behavior/Delegate/DelegateBehavior.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

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

                public function queryMethods(QueryBuilder $builder): string
                {
                    $script = '';
            
                    foreach ($this->delegates as $delegate => $type) {
            Severity: Minor
            Found in src/Propel/Generator/Behavior/Delegate/DelegateBehavior.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