RebelCode/rcmod-wp-bookings-cqrs

View on GitHub

Showing 63 of 63 total issues

Method setup has 401 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function setup()
    {
        return $this->_setupContainer(
            $this->_loadPhpConfigFile(RC_WP_BOOKINGS_CQRS_MODULE_CONFIG_FILE),
            [
Severity: Major
Found in src/Module/WpBookingsCqrsModule.php - About 2 days to fix

    File WpBookingsCqrsModule.php has 456 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace RebelCode\Storage\Resource\WordPress\Module;
    
    use Dhii\Config\ConfigFactoryInterface;
    Severity: Minor
    Found in src/Module/WpBookingsCqrsModule.php - About 6 hrs to fix

      File ResourcesEntityManager.php has 311 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      namespace RebelCode\Storage\Resource\WordPress;
      
      use ArrayAccess;
      Severity: Minor
      Found in src/ResourcesEntityManager.php - About 3 hrs to fix

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

        class ResourcesEntityManager extends BaseCqrsEntityManager
        {
            /* @since [*next-version*] */
            use ContainerGetPathCapableTrait;
        
        
        Severity: Minor
        Found in src/ResourcesEntityManager.php - About 2 hrs to fix

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

          <?php
          
          return [
              // Config for all resource RMs
              'table'            => '${cqrs/table_prefix}resources',
          Severity: Major
          Found in config/resources.php and 2 other locations - About 2 hrs to fix
          config/sessions.php on lines 1..39
          config/transition_log.php on lines 1..41

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 129.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

          <?php
          
          return [
              // Config for all transition log RMs
              'table'            => '${cqrs/table_prefix}transition_logs',
          Severity: Major
          Found in config/transition_log.php and 2 other locations - About 2 hrs to fix
          config/resources.php on lines 1..41
          config/sessions.php on lines 1..39

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 129.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

          <?php
          
          return [
              // Config for all session RMs
              'table'            => '${cqrs/table_prefix}sessions',
          Severity: Major
          Found in config/sessions.php and 2 other locations - About 2 hrs to fix
          config/resources.php on lines 1..41
          config/transition_log.php on lines 1..41

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 129.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Method _updateSessionRules has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function _updateSessionRules($id, $data)
              {
                  $b = $this->exprBuilder;
          
                  try {
          Severity: Minor
          Found in src/ResourcesEntityManager.php - About 1 hr to fix

            Method __construct has 10 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    SelectCapableInterface $selectRm,
                    InsertCapableInterface $insertRm,
                    UpdateCapableInterface $updateRm,
                    DeleteCapableInterface $deleteRm,
                    SelectCapableInterface $rulesSelectRm,
            Severity: Major
            Found in src/ResourcesEntityManager.php - About 1 hr to fix

              Method _processSessionRuleData has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function _processSessionRuleData($resourceId, $ruleData, $serviceTz)
                  {
                      $allDay = $this->_containerGet($ruleData, 'isAllDay');
              
                      // Parse the service timezone name into a timezone object
              Severity: Minor
              Found in src/ResourcesEntityManager.php - About 1 hr to fix

                Avoid using undefined variables such as '$c' which will lead to PHP notices.
                Open

                        $option = $c->get('wp_bookings_cqrs/migrations/db_version_option');
                Severity: Minor
                Found in src/Module/UpdateDbVersionHandler.php by phpmd

                UndefinedVariable

                Since: 2.8.0

                Detects when a variable is used that has not been defined before.

                Example

                class Foo
                {
                    private function bar()
                    {
                        // $message is undefined
                        echo $message;
                    }
                }

                Source https://phpmd.org/rules/cleancode.html#undefinedvariable

                Method __construct has 9 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        wpdb $wpdb,
                        TemplateInterface $template,
                        MapFactoryInterface $mapFactory,
                        $tables,
                        $fieldColumnMap,
                Severity: Major
                Found in src/Wpdb/UnbookedSessionsWpdbSelectResourceModel.php - About 1 hr to fix

                  Method __construct has 9 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          wpdb $wpdb,
                          TemplateInterface $expressionTemplate,
                          MapFactoryInterface $factory,
                          $tables,
                          $fieldColumnMap,
                  Severity: Major
                  Found in src/Wpdb/BookingsSelectResourceModel.php - About 1 hr to fix

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

                            SelectCapableInterface $selectRm,
                            InsertCapableInterface $insertRm,
                            UpdateCapableInterface $updateRm,
                            DeleteCapableInterface $deleteRm,
                            InsertCapableInterface $bkResourcesInsertRm,
                    Severity: Major
                    Found in src/BookingsEntityManager.php - About 1 hr to fix

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

                              wpdb $wpdb,
                              TemplateInterface $expressionTemplate,
                              MapFactoryInterface $factory,
                              $tables,
                              $fieldColumnMap,
                      Severity: Major
                      Found in src/Wpdb/EddBkWpdbSelectResourceModel.php - About 1 hr to fix

                        Method __construct has 7 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                $key,
                                $dependencies,
                                ConfigFactoryInterface $configFactory,
                                ContainerFactoryInterface $containerFactory,
                                ContainerFactoryInterface $compContainerFactory,
                        Severity: Major
                        Found in src/Module/WpBookingsCqrsModule.php - About 50 mins to fix

                          Method __construct has 7 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                  wpdb $wpdb,
                                  TemplateInterface $expressionTemplate,
                                  MapFactoryInterface $mapFactory,
                                  $tables,
                                  $fieldColumnMap,
                          Severity: Major
                          Found in src/Wpdb/BookingStatusWpdbSelectResourceModel.php - About 50 mins to fix

                            Avoid variables with short names like $c. Configured minimum length is 3.
                            Open

                                public function run(ContainerInterface $c = null)
                            Severity: Minor
                            Found in src/Module/WpBookingsCqrsModule.php by phpmd

                            ShortVariable

                            Since: 0.2

                            Detects when a field, local, or parameter has a very short name.

                            Example

                            class Something {
                                private $q = 15; // VIOLATION - Field
                                public static function main( array $as ) { // VIOLATION - Formal
                                    $r = 20 + $this->q; // VIOLATION - Local
                                    for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                        $r += $this->q;
                                    }
                                }
                            }

                            Source https://phpmd.org/rules/naming.html#shortvariable

                            Avoid variables with short names like $id. Configured minimum length is 3.
                            Open

                                public function get($id)
                            Severity: Minor
                            Found in src/BaseCqrsEntityManager.php by phpmd

                            ShortVariable

                            Since: 0.2

                            Detects when a field, local, or parameter has a very short name.

                            Example

                            class Something {
                                private $q = 15; // VIOLATION - Field
                                public static function main( array $as ) { // VIOLATION - Formal
                                    $r = 20 + $this->q; // VIOLATION - Local
                                    for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                        $r += $this->q;
                                    }
                                }
                            }

                            Source https://phpmd.org/rules/naming.html#shortvariable

                            Avoid variables with short names like $id. Configured minimum length is 3.
                            Open

                                public function has($id)
                            Severity: Minor
                            Found in src/BaseCqrsEntityManager.php by phpmd

                            ShortVariable

                            Since: 0.2

                            Detects when a field, local, or parameter has a very short name.

                            Example

                            class Something {
                                private $q = 15; // VIOLATION - Field
                                public static function main( array $as ) { // VIOLATION - Formal
                                    $r = 20 + $this->q; // VIOLATION - Local
                                    for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                        $r += $this->q;
                                    }
                                }
                            }

                            Source https://phpmd.org/rules/naming.html#shortvariable

                            Severity
                            Category
                            Status
                            Source
                            Language