RocketORM/ORM

View on GitHub

Showing 42 of 46 total issues

Query has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class Query implements QueryInterface
{
    const JOIN_TYPE_INNER = 'INNER';
    const JOIN_TYPE_LEFT  = 'LEFT';
Severity: Minor
Found in src/Rocket/ORM/Model/Query/Query.php - About 2 hrs to fix

    Function transformColumns has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public function transformColumns(array $columns)
        {
            foreach ($columns as $column) {
                if (null == $column->phpName) {
                    $column->phpName = StringUtil::camelize($column->name, false);
    Severity: Minor
    Found in src/Rocket/ORM/Generator/Schema/Transformer/SchemaTransformer.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

    TableMap has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    abstract class TableMap implements TableMapInterface
    {
        const COLUMN_TYPE_INTEGER  = 1;
        const COLUMN_TYPE_STRING   = 2;
        const COLUMN_TYPE_DOUBLE   = 3;
    Severity: Minor
    Found in src/Rocket/ORM/Model/Map/TableMap.php - About 2 hrs to fix

      Method getTableColumnConfigurationNode has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function getTableColumnConfigurationNode()
          {
              $builder = new TreeBuilder();
              $columnsNode = $builder->root('columns');
              $columnsNode
      Severity: Major
      Found in src/Rocket/ORM/Generator/Schema/Configuration/SchemaConfiguration.php - About 2 hrs to fix

        Method pluralize has 47 lines of code (exceeds 25 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 1 hr to fix

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

              protected function execute(InputInterface $input, OutputInterface $output)
              {
                  $schemas = $this->getSchemas($this->getSchemaPath());
                  $connections = [];
                  $pendingDatabaseCount = 0;
          Severity: Minor
          Found in src/Rocket/ORM/Command/RocketDatabaseCreateCommand.php - About 1 hr to fix

            Function execute has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function execute(InputInterface $input, OutputInterface $output)
                {
                    $schemas = $this->getSchemas($this->getSchemaPath());
                    $connections = [];
                    $pendingDatabaseCount = 0;
            Severity: Minor
            Found in src/Rocket/ORM/Command/RocketDatabaseCreateCommand.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 getTableRelationConfigurationNode has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function getTableRelationConfigurationNode()
                {
                    $onActionBehaviors = ['CASCADE', 'NO ACTION', 'RESTRICT', 'SET NULL', 'SET DEFAULT'];
            
                    $builder = new TreeBuilder();

              Method hydrateRelation has 36 lines of code (exceeds 25 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

                Function buildClauses has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function buildClauses()
                    {
                        $query = ' WHERE ';
                
                        // FIXME handle the case when a clause need to be encapsulated by parentheses
                Severity: Minor
                Found in src/Rocket/ORM/Model/Query/Query.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

                Function save has a Cognitive Complexity of 12 (exceeds 5 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

                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 load has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function load($path, array $options)
                    {
                        if (null != $path) {
                            if (!is_file($path)) {
                                throw new ConfigurationFileNotFoundException('The rocket configuration file is not found in the selected folder "' . $path . '"');
                Severity: Minor
                Found in src/Rocket/ORM/Config/ConfigLoader.php - About 1 hr to fix

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

                      protected function load($path, array $options)
                      {
                          if (null != $path) {
                              if (!is_file($path)) {
                                  throw new ConfigurationFileNotFoundException('The rocket configuration file is not found in the selected folder "' . $path . '"');
                  Severity: Minor
                  Found in src/Rocket/ORM/Config/ConfigLoader.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 transformColumns has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function transformColumns(array $columns)
                      {
                          foreach ($columns as $column) {
                              if (null == $column->phpName) {
                                  $column->phpName = StringUtil::camelize($column->name, false);
                  Severity: Minor
                  Found in src/Rocket/ORM/Generator/Schema/Transformer/SchemaTransformer.php - About 1 hr to fix

                    Method join has 29 lines of code (exceeds 25 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 1 hr to fix

                      Function validateRelations has a Cognitive Complexity of 10 (exceeds 5 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

                      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 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
                            Severity
                            Category
                            Status
                            Source
                            Language