brokencube/automatorm

View on GitHub

Showing 144 of 452 total issues

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

    public static function format($key, $value, $seen = [], $collectionCount = 0, $exceptionThrown = false)
Severity: Minor
Found in src/Orm/Dump.php - About 35 mins to fix

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

        final public static function factory($where, $classOrTablename = null, $schema = null, array $options = [], $singleResult = false)
    Severity: Minor
    Found in src/Orm/Model.php - About 35 mins to fix

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

          public function duplicate($cloneExternalProps = false, Model $newParent = null)
          {
              $clone = clone $this;
              $clone->new = true;
              $clone->delete = false;
      Severity: Minor
      Found in src/Orm/Data.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 guessContext has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function guessContext($classOrTable)
          {
              // Return 'cached' result
              if (isset(static::$contextCache[$classOrTable])) {
                  return static::$contextCache[$classOrTable];
      Severity: Minor
      Found in src/Orm/Schema.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 addClauses has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function addClauses($clauses)
          {
              foreach ($clauses as $key => $value) {
                  if ($value instanceof QueryBuilder) {
                      $value = new InnerQuery($value);
      Severity: Minor
      Found in src/Database/QueryBuilder/Where.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 __set has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function __set($var, $value)
          {
              // Cannot change data if it is locked (i.e. it is attached to a Model object)
              if ($this->locked) {
                  throw new Exception\Model('MODEL_DATA:SET_WHEN_LOCKED', array($var, $value));
      Severity: Minor
      Found in src/Orm/Data.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 addOnClauses has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function addOnClauses($clauses)
          {
              foreach ($clauses as $key => $value) {
                  if ($value instanceof QueryBuilder) {
                      $value = new InnerQuery($value);
      Severity: Minor
      Found in src/Database/QueryBuilder/Where.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 execute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function execute()
          {
              $pdo = $this->connection->connect();
              
              // We are only allowed to execute each Query object once!
      Severity: Minor
      Found in src/Database/Query.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 makeMessage has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          private function makeMessage($code, $data)
          {
              switch ($code) {
                  case 'NO_GENERATED_SCHEMA':
                      return 'NO_GENERATED_SCHEMA: Could not find a schema definition for namespace: ' . $data;
      Severity: Minor
      Found in src/Exception/Model.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

      Avoid too many return statements within this method.
      Open

                      return 'MODEL_DATA_UPDATE:PIVOT_INCORRECT_OBJECT_TYPE: Trying to update property "'.$table.'" (pivot:.'.$pivot['pivot'].') - Was expecting an array of "'.$pivot['table'].'" objects, but found a "'.$class.'"!';
      Severity: Major
      Found in src/Exception/Model.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                            return 'MODEL_DATA:SCALAR_VALUE_EXPECTED_FOR_COLUMN: Property "'.$column.'" on this object is a database column which can only accept scalar values. You tried to assign a "'.$type.'" to it.';
        Severity: Major
        Found in src/Exception/Model.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return true;
          Severity: Major
          Found in src/Orm/Data.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return static::groupJoinM2M($collection, $var, $where, $onlyCount);
            Severity: Major
            Found in src/Orm/Data.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return null;
              Severity: Major
              Found in src/Orm/Data.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                    return 'MODEL_DATA:MODEL_EXPECTED_FOR_KEY: Property "'.$column.'" expected a Model object, but you gave it an integer - Perhaps you meant to set "'.$column.'_id" instead?';
                Severity: Major
                Found in src/Exception/Model.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                  return 'MODEL_DATA:ARRAY_EXPECTED_FOR_PIVOT: Property "'.$column.'" represents a M-M (Pivot) relationship. It expects an array of Model objects, but you gave it a variable of type "'.$type.'" instead.';
                  Severity: Major
                  Found in src/Exception/Model.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return 'ERROR_DURING_MASS_ASSIGNMENT: During ->assignData(), the following exception occurred: ' . $e->makeMessage($e->code, $e->data);
                    Severity: Major
                    Found in src/Exception/Model.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                      return 'MODEL_DATA:UNKNOWN_FOREIGN_PROPERTY: Tried to access a foreign key not defined in the schema ('.$data['property'].'). Maybe try dump()ing this object to check what keys are available?';
                      Severity: Major
                      Found in src/Exception/Model.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                    return $this->joinM21($var);
                        Severity: Major
                        Found in src/Orm/Data.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      return true;
                          Severity: Major
                          Found in src/Orm/Data.php - About 30 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language