RebelCode/rcmod-eddbk-services

View on GitHub

Showing 70 of 70 total issues

File ServicesEntityManager.php has 409 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace RebelCode\EddBookings\Services\Storage;

use ArrayAccess;
Severity: Minor
Found in src/Storage/ServicesEntityManager.php - About 5 hrs to fix

    ServicesEntityManager has 28 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ServicesEntityManager implements EntityManagerInterface
    {
        /* @since [*next-version*] */
        use ServicesPostKeyMapAwareTrait;
    
    
    Severity: Minor
    Found in src/Storage/ServicesEntityManager.php - About 3 hrs to fix

      The class ServicesEntityManager has an overall complexity of 62 which is very high. The configured complexity threshold is 50.
      Open

      class ServicesEntityManager implements EntityManagerInterface
      {
          /* @since [*next-version*] */
          use ServicesPostKeyMapAwareTrait;
      
      
      Severity: Minor
      Found in src/Storage/ServicesEntityManager.php by phpmd

      Method _getServices has 69 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function _getServices()
          {
              return [
                  /**
                   * The services manager.
      Severity: Major
      Found in services.php - About 2 hrs to fix

        Method _updateAvailability has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function _updateAvailability($id, $ir)
            {
                $b = $this->exprBuilder;
        
                // Get the service's timezone and availability
        Severity: Minor
        Found in src/Storage/ServicesEntityManager.php - About 1 hr to fix

          Method _buildWpQueryArgs has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function _buildWpQueryArgs($query = [], $limit = null, $offset = null, $orderBy = null, $desc = false)
              {
                  // Get post key field map
                  $postKeyMap = $this->_getServicesPostKeyMap();
          
          
          Severity: Minor
          Found in src/Storage/ServicesEntityManager.php - About 1 hr to fix

            Avoid using short method names like GetEddServicePricesCapableTrait::__(). 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 __invoke has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function __invoke()
                {
                    /* @var $event EventInterface */
                    $event = func_get_arg(0);
            
            
            Severity: Minor
            Found in src/Module/AdminDeleteServiceHandler.php - About 1 hr to fix

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

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

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

                    protected function _entityToServiceIr($entity)
                    {
                        $eArray   = $this->_normalizeArray($entity);
                        $postKeys = $this->_getServicesPostKeyMap();
                
                
                Severity: Minor
                Found in src/Storage/ServicesEntityManager.php - About 1 hr to fix

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

                      public function __invoke()
                      {
                          $event = func_get_arg(0);
                  
                          if (!($event instanceof EventInterface)) {
                  Severity: Minor
                  Found in src/Module/HideServicesFromDownloadsHandler.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 __invoke has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function __invoke()
                      {
                          $event = func_get_arg(0);
                  
                          if (!($event instanceof EventInterface)) {
                  Severity: Minor
                  Found in src/Module/HideServicesFromDownloadsHandler.php - About 1 hr to fix

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

                        protected function _getServicesPostKeyMap()
                        {
                            return [
                                // Core service fields
                                'id'               => 'ID',
                    Severity: Minor
                    Found in src/Storage/ServicesPostKeyMapAwareTrait.php - About 1 hr to fix

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

                          protected function _getEddServicePrices($serviceId)
                          {
                              try {
                                  $service = $this->_getServicesManager()->get($serviceId);
                              } catch (NotFoundExceptionInterface $exception) {
                      Severity: Minor
                      Found in src/Module/GetEddServicePricesCapableTrait.php - About 1 hr to fix

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

                                $postType,
                                $metaPrefix,
                                EntityManagerInterface $resourcesManager,
                                SelectCapableInterface $rulesSelectRm,
                                InsertCapableInterface $rulesInsertRm,
                        Severity: Major
                        Found in src/Storage/ServicesEntityManager.php - About 1 hr to fix

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

                              protected function _entityToServiceIr($entity)
                              {
                                  $eArray   = $this->_normalizeArray($entity);
                                  $postKeys = $this->_getServicesPostKeyMap();
                          
                          
                          Severity: Minor
                          Found in src/Storage/ServicesEntityManager.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

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

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

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

                                protected function _updateAvailability($id, $ir)
                            Severity: Minor
                            Found in src/Storage/ServicesEntityManager.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 $ir. Configured minimum length is 3.
                            Open

                                    $ir   = $this->_entityToServiceIr($entity);
                            Severity: Minor
                            Found in src/Storage/ServicesEntityManager.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

                                protected function _updateServiceExternals($id, $ir)
                            Severity: Minor
                            Found in src/Storage/ServicesEntityManager.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