RebelCode/rcmod-eddbk-rest-api

View on GitHub

Showing 87 of 87 total issues

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

<?php

namespace RebelCode\EddBookings\RestApi\Handlers\Services;

use Dhii\Exception\CreateRuntimeExceptionCapableTrait;
Severity: Major
Found in src/Handlers/Services/UpdateServiceHandler.php and 2 other locations - About 2 hrs to fix
src/Handlers/Bookings/UpdateBookingHandler.php on lines 1..53
src/Handlers/Resources/UpdateResourceHandler.php on lines 1..53

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

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

namespace RebelCode\EddBookings\RestApi\Handlers\Bookings;

use Dhii\Exception\CreateRuntimeExceptionCapableTrait;
Severity: Major
Found in src/Handlers/Bookings/UpdateBookingHandler.php and 2 other locations - About 2 hrs to fix
src/Handlers/Resources/UpdateResourceHandler.php on lines 1..53
src/Handlers/Services/UpdateServiceHandler.php on lines 1..53

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

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

namespace RebelCode\EddBookings\RestApi\Handlers\Resources;

use Dhii\Exception\CreateRuntimeExceptionCapableTrait;
Severity: Major
Found in src/Handlers/Resources/UpdateResourceHandler.php and 2 other locations - About 2 hrs to fix
src/Handlers/Bookings/UpdateBookingHandler.php on lines 1..53
src/Handlers/Services/UpdateServiceHandler.php on lines 1..53

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

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

File AbstractBaseCqrsController.php has 251 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace RebelCode\EddBookings\RestApi\Controller;

use ArrayAccess;
Severity: Minor
Found in src/Controller/AbstractBaseCqrsController.php - About 2 hrs to fix

    Method _getSelectConditionParamMapping has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function _getSelectConditionParamMapping()
        {
            return [
                'id'       => [
                    'compare' => 'eq',
    Severity: Minor
    Found in src/Controller/BookingsController.php - About 1 hr to fix

      Method _getBookingMapConfig has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function _getBookingMapConfig()
          {
              return [
                  [
                      MapTransformer::K_SOURCE => 'id',
      Severity: Minor
      Found in src/Transformer/BookingTransformer.php - About 1 hr to fix

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

        <?php
        
        namespace RebelCode\EddBookings\RestApi\Handlers\Sessions;
        
        use RebelCode\EddBookings\RestApi\Controller\ControllerAwareTrait;
        Severity: Major
        Found in src/Handlers/Sessions/QuerySessionsHandler.php and 2 other locations - About 1 hr to fix
        src/Handlers/Clients/QueryClientsHandler.php on lines 1..50
        src/Handlers/Services/QueryServicesHandler.php on lines 1..50

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

        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
        
        namespace RebelCode\EddBookings\RestApi\Handlers\Clients;
        
        use RebelCode\EddBookings\RestApi\Controller\ControllerAwareTrait;
        Severity: Major
        Found in src/Handlers/Clients/QueryClientsHandler.php and 2 other locations - About 1 hr to fix
        src/Handlers/Services/QueryServicesHandler.php on lines 1..50
        src/Handlers/Sessions/QuerySessionsHandler.php on lines 1..50

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

        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
        
        namespace RebelCode\EddBookings\RestApi\Handlers\Services;
        
        use RebelCode\EddBookings\RestApi\Controller\ControllerAwareTrait;
        Severity: Major
        Found in src/Handlers/Services/QueryServicesHandler.php and 2 other locations - About 1 hr to fix
        src/Handlers/Clients/QueryClientsHandler.php on lines 1..50
        src/Handlers/Sessions/QuerySessionsHandler.php on lines 1..50

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

        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

        Avoid excessively long variable names like $hiddenServicesAuthVal. Keep variable name length under 20.
        Open

                ValidatorInterface $hiddenServicesAuthVal,
        Severity: Minor
        Found in src/Controller/ServicesController.php by phpmd

        LongVariable

        Since: 0.2

        Detects when a field, formal or local variable is declared with a long name.

        Example

        class Something {
            protected $reallyLongIntName = -3; // VIOLATION - Field
            public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                $otherReallyLongName = -5; // VIOLATION - Local
                for ($interestingIntIndex = 0; // VIOLATION - For
                     $interestingIntIndex < 10;
                     $interestingIntIndex++ ) {
                }
            }
        }

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

        Avoid excessively long variable names like $hiddenServicesAuthVal. Keep variable name length under 20.
        Open

            protected $hiddenServicesAuthVal;
        Severity: Minor
        Found in src/Controller/ServicesController.php by phpmd

        LongVariable

        Since: 0.2

        Detects when a field, formal or local variable is declared with a long name.

        Example

        class Something {
            protected $reallyLongIntName = -3; // VIOLATION - Field
            public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                $otherReallyLongName = -5; // VIOLATION - Local
                for ($interestingIntIndex = 0; // VIOLATION - For
                     $interestingIntIndex < 10;
                     $interestingIntIndex++ ) {
                }
            }
        }

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

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

            protected function _put($params = [])
            {
                $data = $this->_paramsToServiceData($params);
        
                try {
        Severity: Major
        Found in src/Controller/ServicesController.php and 1 other location - About 1 hr to fix
        src/Controller/ServicesController.php on lines 261..278

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

        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 2 locations. Consider refactoring.
        Open

            protected function _patch($params = [])
            {
                $data = $this->_paramsToServiceData($params);
        
                try {
        Severity: Major
        Found in src/Controller/ServicesController.php and 1 other location - About 1 hr to fix
        src/Controller/ServicesController.php on lines 237..254

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

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

            protected function _getInsertParamFieldMapping()
            {
                return [
                    'start'    => [
                        'field'     => 'start',
        Severity: Minor
        Found in src/Controller/BookingsController.php - About 1 hr to fix

          Avoid using short method names like ControllerAwareTrait::__(). The configured minimum method name length is 3.
          Open

              abstract protected function __($string, $args = [], $context = null);

          ShortMethodName

          Since: 0.2

          Detects when very short method names are used.

          Example

          class ShortMethod {
              public function a( $index ) { // Violation
              }
          }

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

          Method _getResourceDataParamMapping has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function _getResourceDataParamMapping()
              {
                  return [
                      'id'           => [
                          'field'     => 'id',
          Severity: Minor
          Found in src/Controller/ResourcesController.php - About 1 hr to fix

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

                protected function _getServiceMapConfig()
                {
                    return [
                        [
                            MapTransformer::K_SOURCE => 'id',
            Severity: Minor
            Found in src/Transformer/CoreInfoServiceTransformer.php - About 1 hr to fix

              Method _getSelectConditionParamMapping has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function _getSelectConditionParamMapping()
                  {
                      return [
                          'id' => [
                              'compare' => 'eq',
              Severity: Minor
              Found in src/Controller/SessionsController.php - About 1 hr to fix

                Method _post has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function _post($params = [])
                    {
                        // Create state-aware booking from params
                        $booking = $this->stateAwareFactory->make([
                            StateAwareFactoryInterface::K_DATA => $this->_buildInsertRecord($params),
                Severity: Minor
                Found in src/Controller/BookingsController.php - About 1 hr to fix

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

                      protected function _buildInsertRecord($params)
                      {
                          $recordData = [];
                  
                          foreach ($this->_getInsertParamFieldMapping() as $_param => $_mapping) {
                  Severity: Minor
                  Found in src/Controller/AbstractBaseCqrsController.php - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language