RocketORM/ORM

View on GitHub

Showing 46 of 46 total issues

Function hydrateRelation has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    protected function hydrateRelation(array $data, array $item, $alias)
    {
        $hash = Rocket::getTableMap($this->joins[$alias]['relation']['namespace'])->getPrimaryKeysHash($item);
        $relationFrom = $this->joins[$alias]['from'];
        $relationPhpName = $this->joins[$alias]['relation']['phpName'];
Severity: Minor
Found in src/Rocket/ORM/Model/Query/Hydrator/ComplexQueryHydrator.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 validate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function validate(array $schemas)
    {
        $processor = new Processor();
        $configuration = new SchemaConfiguration();
Severity: Minor
Found in src/Rocket/ORM/Generator/Schema/Loader/SchemaLoader.php - About 1 hr to fix

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

        protected function validateRelations(array $normalizedSchemas)
        {
            $transformerClass = $this->options['transformer']['relation']['class'];
            if (is_object($transformerClass)) {
                $schemaRelationTransformer = $transformerClass;
    Severity: Minor
    Found in src/Rocket/ORM/Generator/Schema/Loader/SchemaLoader.php - About 1 hr to fix

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

          public function save(\PDO $con = null)
          {
              if ($this->_isDeleted) {
                  throw new \LogicException('Cannot save a deleted object');
              }
      Severity: Minor
      Found in src/Rocket/ORM/Model/Model.php - About 1 hr to fix

        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 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 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

              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 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

              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 '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 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

                                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

                              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 'date':     return self::COLUMN_TYPE_DATE;
                        Severity: Major
                        Found in src/Rocket/ORM/Model/Map/TableMap.php - About 30 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language