RocketORM/ORM

View on GitHub

Showing 42 of 46 total issues

Method execute has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $schemas = $this->getSchemas($this->getSchemaPath());

        // Generating SQL
Severity: Minor
Found in src/Rocket/ORM/Command/RocketDatabaseInsertCommand.php - About 1 hr to fix

    Method addColumn has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function addColumn($name, $phpName, $type, $size = null, $decimal = 0, array $values = null, $default = null, $isRequired = false)
    Severity: Major
    Found in src/Rocket/ORM/Model/Map/TableMap.php - About 1 hr to fix

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

          public static function pluralize($word)
          {
              static $plurals = [
                  '/(quiz)$/i'                => '\1zes',
                  '/^(ox)$/i'                 => '\1en',
      Severity: Minor
      Found in src/Rocket/ORM/Generator/Utils/StringUtil.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

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

          protected function join($relation, $alias, $joinType = self::JOIN_TYPE_INNER, $with = false)
          {
              $relationTable = $relation;
              $from = null;
      
      Severity: Minor
      Found in src/Rocket/ORM/Model/Query/Query.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 getDefault has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getDefault($raw = false)
          {
              if (TableMap::COLUMN_TYPE_ENUM == $this->type) {
                  if ($raw) {
                      return $this->default;
      Severity: Minor
      Found in src/Rocket/ORM/Generator/Schema/Column.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

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

          public function addRelation($classNamespace, $phpName, $type, $local, $foreign)
      Severity: Minor
      Found in src/Rocket/ORM/Model/Map/TableMap.php - About 35 mins to fix

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

            public function transform(Table $table, array $schemas)
            {
                $relations = $table->getRelations();
                foreach ($relations as $relation) {
                    // Check if local column exists

        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 delete has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function delete(\PDO $con = null)
            {
                if ($this->_isNew) {
                    throw new \LogicException('Cannot delete a new object');
                }
        Severity: Minor
        Found in src/Rocket/ORM/Model/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

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

            public function hydrate(\PDOStatement $stmt)
            {
                while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
                    $data = $this->getRowDataByAlias($row);
        
        Severity: Minor
        Found in src/Rocket/ORM/Model/Query/Hydrator/ComplexQueryHydrator.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 getSqlQuery has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getSqlQuery()
            {
                $query = $this->buildQuery();
                if (0 < sizeof($this->clauses)) {
                    foreach ($this->clauses as $i => $clauseParams) {
        Severity: Minor
        Found in src/Rocket/ORM/Model/Query/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

        Avoid too many return statements within this method.
        Open

                    case 'datetime': return self::COLUMN_TYPE_DATETIME;
        Severity: Major
        Found in src/Rocket/ORM/Model/Map/TableMap.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      case 'float':    return self::COLUMN_TYPE_FLOAT;
          Severity: Major
          Found in src/Rocket/ORM/Model/Map/TableMap.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        case 'double':   return self::COLUMN_TYPE_DOUBLE;
            Severity: Major
            Found in src/Rocket/ORM/Model/Map/TableMap.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          case TableMap::COLUMN_TYPE_FLOAT:    return 'float';
              Severity: Major
              Found in src/Rocket/ORM/Generator/Schema/Column.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            case TableMap::COLUMN_TYPE_TEXT:     return 'string';
                Severity: Major
                Found in src/Rocket/ORM/Generator/Schema/Column.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return 'mixed';
                  Severity: Major
                  Found in src/Rocket/ORM/Generator/Schema/Column.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                case 'enum':     return self::COLUMN_TYPE_ENUM;
                    Severity: Major
                    Found in src/Rocket/ORM/Model/Map/TableMap.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  case 'date':     return self::COLUMN_TYPE_DATE;
                      Severity: Major
                      Found in src/Rocket/ORM/Model/Map/TableMap.php - About 30 mins to fix

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

                            protected function guessRelationType(Column $local, Table $relatedTable, Relation $relation)
                            {
                                if (!$local->isPrimaryKey) {
                                    $relation->type = TableMap::RELATION_TYPE_ONE_TO_MANY;
                                } else {

                        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 getClassNamespace has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static function getClassNamespace(array $config, $name)
                            {
                                if (isset($config['connections'][$name]['class']) && null != $config['connections'][$name]['class']) {
                                    $class = $config['connections'][$name]['class'];
                                } elseif (isset($config['connection_class']) && null != $config['connection_class']) {
                        Severity: Minor
                        Found in src/Rocket/ORM/Connection/ConnectionFactory.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

                        Severity
                        Category
                        Status
                        Source
                        Language