autowp/autowp

View on GitHub
module/Application/src/Service/SpecificationsService.php

Summary

Maintainability
F
3 wks
Test Coverage
F
52%

File SpecificationsService.php has 1897 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Application\Service;

use Application\ItemNameFormatter;
Severity: Major
Found in module/Application/src/Service/SpecificationsService.php - About 5 days to fix

    SpecificationsService has 64 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class SpecificationsService
    {
        private const
            DEFAULT_ZONE_ID = 1,
            ENGINE_ZONE_ID  = 5,
    Severity: Major
    Found in module/Application/src/Service/SpecificationsService.php - About 1 day to fix

      Function setUserValue has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
      Open

          public function setUserValue(int $uid, int $attributeId, int $itemId, $value): void
          {
              $attribute = $this->getAttribute($attributeId);
              if (! $attribute) {
                  throw new Exception("attribute `$attributeId` not found");
      Severity: Minor
      Found in module/Application/src/Service/SpecificationsService.php - About 1 day 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 getAttributes has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getAttributes(array $options = []): array
          {
              $defaults = [
                  'zone'      => null,
                  'parent'    => null,
      Severity: Minor
      Found in module/Application/src/Service/SpecificationsService.php - About 5 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

      Function setUserValue2 has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
      Open

          public function setUserValue2(int $uid, int $attributeId, int $itemId, $value, bool $empty): void
          {
              $attribute = $this->getAttribute($attributeId);
              if (! $attribute) {
                  throw new Exception("attribute `$attributeId` not found");
      Severity: Minor
      Found in module/Application/src/Service/SpecificationsService.php - About 5 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

      Function calcInheritedValue has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
      Open

          private function calcInheritedValue($attribute, int $itemId): array
          {
              $actualValue = [
                  'empty' => true,
                  'value' => null,
      Severity: Minor
      Found in module/Application/src/Service/SpecificationsService.php - About 5 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

      Function refreshConflictFlag has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

          public function refreshConflictFlag(int $attributeId, int $itemId): void
          {
              if (! $attributeId) {
                  throw new Exception("attributeId not provided");
              }
      Severity: Minor
      Found in module/Application/src/Service/SpecificationsService.php - About 4 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

      Function calcAvgUserValue has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

          private function calcAvgUserValue(array $attribute, int $itemId): array
          {
              $userValuesDataTable = $this->getUserValueDataTable($attribute['typeId']);
      
              $userValueDataRows = $userValuesDataTable->select([
      Severity: Minor
      Found in module/Application/src/Service/SpecificationsService.php - About 4 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

      Function getZoneItemsActualValues has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

          private function getZoneItemsActualValues(int $zoneId, array $itemIds): array
          {
              if (count($itemIds) <= 0) {
                  return [];
              }
      Severity: Minor
      Found in module/Application/src/Service/SpecificationsService.php - About 4 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

      Function specifications has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          public function specifications(array $cars, array $options): CarSpecTable
          {
              $options = array_merge([
                  'contextCarId' => null,
                  'language'     => 'en',
      Severity: Minor
      Found in module/Application/src/Service/SpecificationsService.php - About 4 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

      Method getFilterSpec has 98 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getFilterSpec(int $attributeId): ?array
          {
              $filters    = [];
              $validators = [];
      
      
      Severity: Major
      Found in module/Application/src/Service/SpecificationsService.php - About 3 hrs to fix

        Method specifications has 97 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function specifications(array $cars, array $options): CarSpecTable
            {
                $options = array_merge([
                    'contextCarId' => null,
                    'language'     => 'en',
        Severity: Major
        Found in module/Application/src/Service/SpecificationsService.php - About 3 hrs to fix

          Method refreshConflictFlag has 96 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function refreshConflictFlag(int $attributeId, int $itemId): void
              {
                  if (! $attributeId) {
                      throw new Exception("attributeId not provided");
                  }
          Severity: Major
          Found in module/Application/src/Service/SpecificationsService.php - About 3 hrs to fix

            Method setUserValue2 has 95 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function setUserValue2(int $uid, int $attributeId, int $itemId, $value, bool $empty): void
                {
                    $attribute = $this->getAttribute($attributeId);
                    if (! $attribute) {
                        throw new Exception("attribute `$attributeId` not found");
            Severity: Major
            Found in module/Application/src/Service/SpecificationsService.php - About 3 hrs to fix

              Method setUserValue has 94 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function setUserValue(int $uid, int $attributeId, int $itemId, $value): void
                  {
                      $attribute = $this->getAttribute($attributeId);
                      if (! $attribute) {
                          throw new Exception("attribute `$attributeId` not found");
              Severity: Major
              Found in module/Application/src/Service/SpecificationsService.php - About 3 hrs to fix

                The class SpecificationsService has 29 non-getter- and setter-methods. Consider refactoring SpecificationsService to keep number of methods under 25.
                Open

                class SpecificationsService
                {
                    private const
                        DEFAULT_ZONE_ID = 1,
                        ENGINE_ZONE_ID  = 5,

                TooManyMethods

                Since: 0.1

                A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

                By default it ignores methods starting with 'get' or 'set'.

                The default was changed from 10 to 25 in PHPMD 2.3.

                Example

                Source https://phpmd.org/rules/codesize.html#toomanymethods

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

                class SpecificationsService
                {
                    private const
                        DEFAULT_ZONE_ID = 1,
                        ENGINE_ZONE_ID  = 5,

                The class SpecificationsService has 13 public methods. Consider refactoring SpecificationsService to keep number of public methods under 10.
                Open

                class SpecificationsService
                {
                    private const
                        DEFAULT_ZONE_ID = 1,
                        ENGINE_ZONE_ID  = 5,

                TooManyPublicMethods

                Since: 0.1

                A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

                By default it ignores methods starting with 'get' or 'set'.

                Example

                Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

                Function setActualValue has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function setActualValue(array $attribute, int $itemId, array $actualValue): bool
                    {
                        $valueDataTable = $this->getValueDataTable($attribute['typeId']);
                
                        $somethingChanges = false;
                Severity: Minor
                Found in module/Application/src/Service/SpecificationsService.php - About 3 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

                Method calcAvgUserValue has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function calcAvgUserValue(array $attribute, int $itemId): array
                    {
                        $userValuesDataTable = $this->getUserValueDataTable($attribute['typeId']);
                
                        $userValueDataRows = $userValuesDataTable->select([
                Severity: Major
                Found in module/Application/src/Service/SpecificationsService.php - About 3 hrs to fix

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

                      private function setActualValue(array $attribute, int $itemId, array $actualValue): bool
                      {
                          $valueDataTable = $this->getValueDataTable($attribute['typeId']);
                  
                          $somethingChanges = false;
                  Severity: Major
                  Found in module/Application/src/Service/SpecificationsService.php - About 2 hrs to fix

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

                            TranslatorInterface $translator,
                            ItemNameFormatter $itemNameFormatter,
                            Item $itemModel,
                            ItemParent $itemParent,
                            Picture $picture,
                    Severity: Major
                    Found in module/Application/src/Service/SpecificationsService.php - About 2 hrs to fix

                      Function getItemsActualValues has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function getItemsActualValues(array $itemIds): array
                          {
                              if (count($itemIds) <= 0) {
                                  return [];
                              }
                      Severity: Minor
                      Found in module/Application/src/Service/SpecificationsService.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

                      Method getAttributes has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function getAttributes(array $options = []): array
                          {
                              $defaults = [
                                  'zone'      => null,
                                  'parent'    => null,
                      Severity: Major
                      Found in module/Application/src/Service/SpecificationsService.php - About 2 hrs to fix

                        Method calcEngineValue has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function calcEngineValue($attribute, int $itemId): array
                            {
                                if (! $this->isEngineAttributeId($attribute['id'])) {
                                    return [
                                        'empty' => true,
                        Severity: Major
                        Found in module/Application/src/Service/SpecificationsService.php - About 2 hrs to fix

                          Method getConflicts has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function getConflicts(int $userId, $filter, int $page, int $perPage): array
                              {
                                  $userId = (int) $userId;
                          
                                  $select = new Sql\Select($this->valueTable->getTable());
                          Severity: Major
                          Found in module/Application/src/Service/SpecificationsService.php - About 2 hrs to fix

                            Function valueToText has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                            Open

                                private function valueToText(array $attribute, $value, string $language)
                                {
                                    if ($value === null) {
                                        return null;
                                    }
                            Severity: Minor
                            Found in module/Application/src/Service/SpecificationsService.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

                            Method getZoneItemsActualValues has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private function getZoneItemsActualValues(int $zoneId, array $itemIds): array
                                {
                                    if (count($itemIds) <= 0) {
                                        return [];
                                    }
                            Severity: Minor
                            Found in module/Application/src/Service/SpecificationsService.php - About 2 hrs to fix

                              Method calcInheritedValue has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  private function calcInheritedValue($attribute, int $itemId): array
                                  {
                                      $actualValue = [
                                          'empty' => true,
                                          'value' => null,
                              Severity: Minor
                              Found in module/Application/src/Service/SpecificationsService.php - About 2 hrs to fix

                                Function removeEmpty has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    private function removeEmpty(array &$attributes, array $cars): void
                                    {
                                        foreach ($attributes as $idx => &$attribute) {
                                            $this->removeEmpty($attribute['childs'], $cars);
                                
                                
                                Severity: Minor
                                Found in module/Application/src/Service/SpecificationsService.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 getFilterSpec has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function getFilterSpec(int $attributeId): ?array
                                    {
                                        $filters    = [];
                                        $validators = [];
                                
                                
                                Severity: Minor
                                Found in module/Application/src/Service/SpecificationsService.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 calcEngineValue has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    private function calcEngineValue($attribute, int $itemId): array
                                    {
                                        if (! $this->isEngineAttributeId($attribute['id'])) {
                                            return [
                                                'empty' => true,
                                Severity: Minor
                                Found in module/Application/src/Service/SpecificationsService.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 valueToText has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    private function valueToText(array $attribute, $value, string $language)
                                    {
                                        if ($value === null) {
                                            return null;
                                        }
                                Severity: Minor
                                Found in module/Application/src/Service/SpecificationsService.php - About 1 hr to fix

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

                                      public function getUserValue2(int $attributeId, int $itemId, int $userId): array
                                      {
                                          if (! $itemId) {
                                              throw new Exception("item_id not set");
                                          }
                                  Severity: Minor
                                  Found in module/Application/src/Service/SpecificationsService.php - About 1 hr to fix

                                    The class SpecificationsService has 32 fields. Consider redesigning SpecificationsService to keep the number of fields under 15.
                                    Open

                                    class SpecificationsService
                                    {
                                        private const
                                            DEFAULT_ZONE_ID = 1,
                                            ENGINE_ZONE_ID  = 5,

                                    TooManyFields

                                    Since: 0.1

                                    Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

                                    Example

                                    class Person {
                                       protected $one;
                                       private $two;
                                       private $three;
                                       [... many more fields ...]
                                    }

                                    Source https://phpmd.org/rules/codesize.html#toomanyfields

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

                                        private function getItemsActualValues(array $itemIds): array
                                        {
                                            if (count($itemIds) <= 0) {
                                                return [];
                                            }
                                    Severity: Minor
                                    Found in module/Application/src/Service/SpecificationsService.php - About 1 hr to fix

                                      Method getUserValueText has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          public function getUserValueText(int $attributeId, int $itemId, int $userId, string $language): ?string
                                          {
                                              if (! $itemId) {
                                                  throw new Exception("item_id not set");
                                              }
                                      Severity: Minor
                                      Found in module/Application/src/Service/SpecificationsService.php - About 1 hr to fix

                                        Method loadAttributes has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            private function loadAttributes(): self
                                            {
                                                if (! isset($this->attributes)) {
                                                    $array  = [];
                                                    $childs = [];
                                        Severity: Minor
                                        Found in module/Application/src/Service/SpecificationsService.php - About 1 hr to fix

                                          Method getActualValue has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                              public function getActualValue(int $attributeId, int $itemId)
                                              {
                                                  if (! $itemId) {
                                                      throw new Exception("item_id not set");
                                                  }
                                          Severity: Minor
                                          Found in module/Application/src/Service/SpecificationsService.php - About 1 hr to fix

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

                                                private function loadListOptions(array $attributeIds): void
                                                {
                                                    $ids = array_diff($attributeIds, array_keys($this->listOptions));
                                            
                                                    if (count($ids)) {
                                            Severity: Minor
                                            Found in module/Application/src/Service/SpecificationsService.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 getActualValue has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                public function getActualValue(int $attributeId, int $itemId)
                                                {
                                                    if (! $itemId) {
                                                        throw new Exception("item_id not set");
                                                    }
                                            Severity: Minor
                                            Found in module/Application/src/Service/SpecificationsService.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 loadAttributes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                private function loadAttributes(): self
                                                {
                                                    if (! isset($this->attributes)) {
                                                        $array  = [];
                                                        $childs = [];
                                            Severity: Minor
                                            Found in module/Application/src/Service/SpecificationsService.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 getUserValue has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                                public function getUserValue(int $attributeId, int $itemId, int $userId)
                                                {
                                                    if (! $itemId) {
                                                        throw new Exception("item_id not set");
                                                    }
                                            Severity: Minor
                                            Found in module/Application/src/Service/SpecificationsService.php - About 1 hr to fix

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

                                                  public function getConflicts(int $userId, $filter, int $page, int $perPage): array
                                                  {
                                                      $userId = (int) $userId;
                                              
                                                      $select = new Sql\Select($this->valueTable->getTable());
                                              Severity: Minor
                                              Found in module/Application/src/Service/SpecificationsService.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 getUserValueText has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  public function getUserValueText(int $attributeId, int $itemId, int $userId, string $language): ?string
                                                  {
                                                      if (! $itemId) {
                                                          throw new Exception("item_id not set");
                                                      }
                                              Severity: Minor
                                              Found in module/Application/src/Service/SpecificationsService.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 setUserValue2 has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                              Open

                                                  public function setUserValue2(int $uid, int $attributeId, int $itemId, $value, bool $empty): void
                                              Severity: Minor
                                              Found in module/Application/src/Service/SpecificationsService.php - About 35 mins to fix

                                                Function hasChildSpecs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                Open

                                                    public function hasChildSpecs($itemId)
                                                    {
                                                        $select = new Sql\Select($this->valueTable->getTable());
                                                
                                                        $select->columns([])
                                                Severity: Minor
                                                Found in module/Application/src/Service/SpecificationsService.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 hasSpecs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                Open

                                                    public function hasSpecs($itemId)
                                                    {
                                                        $select = new Sql\Select($this->valueTable->getTable());
                                                        $select->columns(['item_id']);
                                                        if (is_array($itemId)) {
                                                Severity: Minor
                                                Found in module/Application/src/Service/SpecificationsService.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 getActualValueText has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                Open

                                                    public function getActualValueText(int $attributeId, int $itemId, string $language): ?string
                                                    {
                                                        if (! $itemId) {
                                                            throw new Exception("item_id not set");
                                                        }
                                                Severity: Minor
                                                Found in module/Application/src/Service/SpecificationsService.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

                                                                return $value ? 'да' : 'нет';
                                                Severity: Major
                                                Found in module/Application/src/Service/SpecificationsService.php - About 30 mins to fix

                                                  Avoid too many return statements within this method.
                                                  Open

                                                                  return $value;
                                                  Severity: Major
                                                  Found in module/Application/src/Service/SpecificationsService.php - About 30 mins to fix

                                                    Avoid too many return statements within this method.
                                                    Open

                                                            return null;
                                                    Severity: Major
                                                    Found in module/Application/src/Service/SpecificationsService.php - About 30 mins to fix

                                                      Avoid too many return statements within this method.
                                                      Open

                                                                      return [
                                                                          'empty' => false,
                                                                          'value' => $value,
                                                                      ];
                                                      Severity: Major
                                                      Found in module/Application/src/Service/SpecificationsService.php - About 30 mins to fix

                                                        Avoid too many return statements within this method.
                                                        Open

                                                                        return [
                                                                            'empty' => true,
                                                                            'value' => null,
                                                                        ];
                                                        Severity: Major
                                                        Found in module/Application/src/Service/SpecificationsService.php - About 30 mins to fix

                                                          Avoid too many return statements within this method.
                                                          Open

                                                                  return null;
                                                          Severity: Major
                                                          Found in module/Application/src/Service/SpecificationsService.php - About 30 mins to fix

                                                            Avoid too many return statements within this method.
                                                            Open

                                                                            return [
                                                                                'empty' => true,
                                                                                'value' => null,
                                                                            ];
                                                            Severity: Major
                                                            Found in module/Application/src/Service/SpecificationsService.php - About 30 mins to fix

                                                              Avoid too many return statements within this method.
                                                              Open

                                                                              return $value === null ? null : ($value ? 1 : 0);
                                                              Severity: Major
                                                              Found in module/Application/src/Service/SpecificationsService.php - About 30 mins to fix

                                                                Avoid too many return statements within this method.
                                                                Open

                                                                                        return $nullText ? null : implode(', ', $text);
                                                                Severity: Major
                                                                Found in module/Application/src/Service/SpecificationsService.php - About 30 mins to fix

                                                                  Avoid too many return statements within this method.
                                                                  Open

                                                                                  return $value === null ? null : (int) $value;
                                                                  Severity: Major
                                                                  Found in module/Application/src/Service/SpecificationsService.php - About 30 mins to fix

                                                                    Avoid too many return statements within this method.
                                                                    Open

                                                                                            return $this->getListOptionsText($attribute['id'], $value);
                                                                    Severity: Major
                                                                    Found in module/Application/src/Service/SpecificationsService.php - About 30 mins to fix

                                                                      Function propagateInheritance has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                      Open

                                                                          private function propagateInheritance(array $attribute, int $itemId): void
                                                                          {
                                                                              $childIds = $this->getChildCarIds($itemId);
                                                                      
                                                                              foreach ($childIds as $childId) {
                                                                      Severity: Minor
                                                                      Found in module/Application/src/Service/SpecificationsService.php - About 25 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 updateInheritedValues has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                      Open

                                                                          public function updateInheritedValues(int $itemId): void
                                                                          {
                                                                              foreach ($this->getAttributes() as $attribute) {
                                                                                  if ($attribute['typeId']) {
                                                                                      $haveValue = $this->haveOwnAttributeValue($attribute['id'], $itemId);
                                                                      Severity: Minor
                                                                      Found in module/Application/src/Service/SpecificationsService.php - About 25 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 updateAllActualValues has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                      Open

                                                                          public function updateAllActualValues(): void
                                                                          {
                                                                              $attributes = $this->getAttributes();
                                                                      
                                                                              $select = $this->userValueTable->getSql()->select();
                                                                      Severity: Minor
                                                                      Found in module/Application/src/Service/SpecificationsService.php - About 25 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 getListOptionsArrayRecursive has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                      Open

                                                                          private function getListOptionsArrayRecursive(int $aid, int $parentId): array
                                                                          {
                                                                              $result = [];
                                                                              if (isset($this->listOptionsChilds[$aid][$parentId])) {
                                                                                  foreach ($this->listOptionsChilds[$aid][$parentId] as $childId) {
                                                                      Severity: Minor
                                                                      Found in module/Application/src/Service/SpecificationsService.php - About 25 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 getListOptions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                      Open

                                                                          private function getListOptions(int $aid, int $parentId): array
                                                                          {
                                                                              $result = [];
                                                                              if (isset($this->listOptionsChilds[$aid][$parentId])) {
                                                                                  foreach ($this->listOptionsChilds[$aid][$parentId] as $childId) {
                                                                      Severity: Minor
                                                                      Found in module/Application/src/Service/SpecificationsService.php - About 25 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 getUserValue2 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                      Open

                                                                          public function getUserValue2(int $attributeId, int $itemId, int $userId): array
                                                                          {
                                                                              if (! $itemId) {
                                                                                  throw new Exception("item_id not set");
                                                                              }
                                                                      Severity: Minor
                                                                      Found in module/Application/src/Service/SpecificationsService.php - About 25 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

                                                                      The method __construct has 22 parameters. Consider reducing the number of parameters to less than 10.
                                                                      Open

                                                                          public function __construct(
                                                                              TranslatorInterface $translator,
                                                                              ItemNameFormatter $itemNameFormatter,
                                                                              Item $itemModel,
                                                                              ItemParent $itemParent,

                                                                      The method setUserValue() has 126 lines of code. Current threshold is set to 100. Avoid really long methods.
                                                                      Open

                                                                          public function setUserValue(int $uid, int $attributeId, int $itemId, $value): void
                                                                          {
                                                                              $attribute = $this->getAttribute($attributeId);
                                                                              if (! $attribute) {
                                                                                  throw new Exception("attribute `$attributeId` not found");

                                                                      The method specifications() has 125 lines of code. Current threshold is set to 100. Avoid really long methods.
                                                                      Open

                                                                          public function specifications(array $cars, array $options): CarSpecTable
                                                                          {
                                                                              $options = array_merge([
                                                                                  'contextCarId' => null,
                                                                                  'language'     => 'en',

                                                                      The method getZoneItemsActualValues() has an NPath complexity of 224. The configured NPath complexity threshold is 200.
                                                                      Open

                                                                          private function getZoneItemsActualValues(int $zoneId, array $itemIds): array
                                                                          {
                                                                              if (count($itemIds) <= 0) {
                                                                                  return [];
                                                                              }

                                                                      NPathComplexity

                                                                      Since: 0.1

                                                                      The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                                                                      Example

                                                                      class Foo {
                                                                          function bar() {
                                                                              // lots of complicated code
                                                                          }
                                                                      }

                                                                      Source https://phpmd.org/rules/codesize.html#npathcomplexity

                                                                      The method setUserValue() has an NPath complexity of 256. The configured NPath complexity threshold is 200.
                                                                      Open

                                                                          public function setUserValue(int $uid, int $attributeId, int $itemId, $value): void
                                                                          {
                                                                              $attribute = $this->getAttribute($attributeId);
                                                                              if (! $attribute) {
                                                                                  throw new Exception("attribute `$attributeId` not found");

                                                                      NPathComplexity

                                                                      Since: 0.1

                                                                      The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                                                                      Example

                                                                      class Foo {
                                                                          function bar() {
                                                                              // lots of complicated code
                                                                          }
                                                                      }

                                                                      Source https://phpmd.org/rules/codesize.html#npathcomplexity

                                                                      The method refreshConflictFlag() has an NPath complexity of 5568. The configured NPath complexity threshold is 200.
                                                                      Open

                                                                          public function refreshConflictFlag(int $attributeId, int $itemId): void
                                                                          {
                                                                              if (! $attributeId) {
                                                                                  throw new Exception("attributeId not provided");
                                                                              }

                                                                      NPathComplexity

                                                                      Since: 0.1

                                                                      The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                                                                      Example

                                                                      class Foo {
                                                                          function bar() {
                                                                              // lots of complicated code
                                                                          }
                                                                      }

                                                                      Source https://phpmd.org/rules/codesize.html#npathcomplexity

                                                                      The method setUserValue2() has 130 lines of code. Current threshold is set to 100. Avoid really long methods.
                                                                      Open

                                                                          public function setUserValue2(int $uid, int $attributeId, int $itemId, $value, bool $empty): void
                                                                          {
                                                                              $attribute = $this->getAttribute($attributeId);
                                                                              if (! $attribute) {
                                                                                  throw new Exception("attribute `$attributeId` not found");

                                                                      The class SpecificationsService has 2427 lines of code. Current threshold is 1000. Avoid really long classes.
                                                                      Open

                                                                      class SpecificationsService
                                                                      {
                                                                          private const
                                                                              DEFAULT_ZONE_ID = 1,
                                                                              ENGINE_ZONE_ID  = 5,

                                                                      The method getFilterSpec() has 114 lines of code. Current threshold is set to 100. Avoid really long methods.
                                                                      Open

                                                                          public function getFilterSpec(int $attributeId): ?array
                                                                          {
                                                                              $filters    = [];
                                                                              $validators = [];
                                                                      
                                                                      

                                                                      The method refreshConflictFlag() has 117 lines of code. Current threshold is set to 100. Avoid really long methods.
                                                                      Open

                                                                          public function refreshConflictFlag(int $attributeId, int $itemId): void
                                                                          {
                                                                              if (! $attributeId) {
                                                                                  throw new Exception("attributeId not provided");
                                                                              }

                                                                      The method specifications() has an NPath complexity of 10368. The configured NPath complexity threshold is 200.
                                                                      Open

                                                                          public function specifications(array $cars, array $options): CarSpecTable
                                                                          {
                                                                              $options = array_merge([
                                                                                  'contextCarId' => null,
                                                                                  'language'     => 'en',

                                                                      NPathComplexity

                                                                      Since: 0.1

                                                                      The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                                                                      Example

                                                                      class Foo {
                                                                          function bar() {
                                                                              // lots of complicated code
                                                                          }
                                                                      }

                                                                      Source https://phpmd.org/rules/codesize.html#npathcomplexity

                                                                      The method calcAvgUserValue() has an NPath complexity of 4632. The configured NPath complexity threshold is 200.
                                                                      Open

                                                                          private function calcAvgUserValue(array $attribute, int $itemId): array
                                                                          {
                                                                              $userValuesDataTable = $this->getUserValueDataTable($attribute['typeId']);
                                                                      
                                                                              $userValueDataRows = $userValuesDataTable->select([

                                                                      NPathComplexity

                                                                      Since: 0.1

                                                                      The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                                                                      Example

                                                                      class Foo {
                                                                          function bar() {
                                                                              // lots of complicated code
                                                                          }
                                                                      }

                                                                      Source https://phpmd.org/rules/codesize.html#npathcomplexity

                                                                      The method getFilterSpec() has a Cyclomatic Complexity of 15. The configured cyclomatic complexity threshold is 10.
                                                                      Open

                                                                          public function getFilterSpec(int $attributeId): ?array
                                                                          {
                                                                              $filters    = [];
                                                                              $validators = [];
                                                                      
                                                                      

                                                                      CyclomaticComplexity

                                                                      Since: 0.1

                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                      Example

                                                                      // Cyclomatic Complexity = 11
                                                                      class Foo {
                                                                      1   public function example() {
                                                                      2       if ($a == $b) {
                                                                      3           if ($a1 == $b1) {
                                                                                      fiddle();
                                                                      4           } elseif ($a2 == $b2) {
                                                                                      fiddle();
                                                                                  } else {
                                                                                      fiddle();
                                                                                  }
                                                                      5       } elseif ($c == $d) {
                                                                      6           while ($c == $d) {
                                                                                      fiddle();
                                                                                  }
                                                                      7        } elseif ($e == $f) {
                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                      fiddle();
                                                                                  }
                                                                              } else {
                                                                                  switch ($z) {
                                                                      9               case 1:
                                                                                          fiddle();
                                                                                          break;
                                                                      10              case 2:
                                                                                          fiddle();
                                                                                          break;
                                                                      11              case 3:
                                                                                          fiddle();
                                                                                          break;
                                                                                      default:
                                                                                          fiddle();
                                                                                          break;
                                                                                  }
                                                                              }
                                                                          }
                                                                      }

                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                      The method refreshConflictFlag() has a Cyclomatic Complexity of 19. The configured cyclomatic complexity threshold is 10.
                                                                      Open

                                                                          public function refreshConflictFlag(int $attributeId, int $itemId): void
                                                                          {
                                                                              if (! $attributeId) {
                                                                                  throw new Exception("attributeId not provided");
                                                                              }

                                                                      CyclomaticComplexity

                                                                      Since: 0.1

                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                      Example

                                                                      // Cyclomatic Complexity = 11
                                                                      class Foo {
                                                                      1   public function example() {
                                                                      2       if ($a == $b) {
                                                                      3           if ($a1 == $b1) {
                                                                                      fiddle();
                                                                      4           } elseif ($a2 == $b2) {
                                                                                      fiddle();
                                                                                  } else {
                                                                                      fiddle();
                                                                                  }
                                                                      5       } elseif ($c == $d) {
                                                                      6           while ($c == $d) {
                                                                                      fiddle();
                                                                                  }
                                                                      7        } elseif ($e == $f) {
                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                      fiddle();
                                                                                  }
                                                                              } else {
                                                                                  switch ($z) {
                                                                      9               case 1:
                                                                                          fiddle();
                                                                                          break;
                                                                      10              case 2:
                                                                                          fiddle();
                                                                                          break;
                                                                      11              case 3:
                                                                                          fiddle();
                                                                                          break;
                                                                                      default:
                                                                                          fiddle();
                                                                                          break;
                                                                                  }
                                                                              }
                                                                          }
                                                                      }

                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                      The method prepareValue() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
                                                                      Open

                                                                          private function prepareValue(int $typeId, $value)
                                                                          {
                                                                              switch ($typeId) {
                                                                                  case 1: // string
                                                                                      return $value;

                                                                      CyclomaticComplexity

                                                                      Since: 0.1

                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                      Example

                                                                      // Cyclomatic Complexity = 11
                                                                      class Foo {
                                                                      1   public function example() {
                                                                      2       if ($a == $b) {
                                                                      3           if ($a1 == $b1) {
                                                                                      fiddle();
                                                                      4           } elseif ($a2 == $b2) {
                                                                                      fiddle();
                                                                                  } else {
                                                                                      fiddle();
                                                                                  }
                                                                      5       } elseif ($c == $d) {
                                                                      6           while ($c == $d) {
                                                                                      fiddle();
                                                                                  }
                                                                      7        } elseif ($e == $f) {
                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                      fiddle();
                                                                                  }
                                                                              } else {
                                                                                  switch ($z) {
                                                                      9               case 1:
                                                                                          fiddle();
                                                                                          break;
                                                                      10              case 2:
                                                                                          fiddle();
                                                                                          break;
                                                                      11              case 3:
                                                                                          fiddle();
                                                                                          break;
                                                                                      default:
                                                                                          fiddle();
                                                                                          break;
                                                                                  }
                                                                              }
                                                                          }
                                                                      }

                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                      The method setUserValue() has a Cyclomatic Complexity of 20. The configured cyclomatic complexity threshold is 10.
                                                                      Open

                                                                          public function setUserValue(int $uid, int $attributeId, int $itemId, $value): void
                                                                          {
                                                                              $attribute = $this->getAttribute($attributeId);
                                                                              if (! $attribute) {
                                                                                  throw new Exception("attribute `$attributeId` not found");

                                                                      CyclomaticComplexity

                                                                      Since: 0.1

                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                      Example

                                                                      // Cyclomatic Complexity = 11
                                                                      class Foo {
                                                                      1   public function example() {
                                                                      2       if ($a == $b) {
                                                                      3           if ($a1 == $b1) {
                                                                                      fiddle();
                                                                      4           } elseif ($a2 == $b2) {
                                                                                      fiddle();
                                                                                  } else {
                                                                                      fiddle();
                                                                                  }
                                                                      5       } elseif ($c == $d) {
                                                                      6           while ($c == $d) {
                                                                                      fiddle();
                                                                                  }
                                                                      7        } elseif ($e == $f) {
                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                      fiddle();
                                                                                  }
                                                                              } else {
                                                                                  switch ($z) {
                                                                      9               case 1:
                                                                                          fiddle();
                                                                                          break;
                                                                      10              case 2:
                                                                                          fiddle();
                                                                                          break;
                                                                      11              case 3:
                                                                                          fiddle();
                                                                                          break;
                                                                                      default:
                                                                                          fiddle();
                                                                                          break;
                                                                                  }
                                                                              }
                                                                          }
                                                                      }

                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                      The method specifications() has a Cyclomatic Complexity of 18. The configured cyclomatic complexity threshold is 10.
                                                                      Open

                                                                          public function specifications(array $cars, array $options): CarSpecTable
                                                                          {
                                                                              $options = array_merge([
                                                                                  'contextCarId' => null,
                                                                                  'language'     => 'en',

                                                                      CyclomaticComplexity

                                                                      Since: 0.1

                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                      Example

                                                                      // Cyclomatic Complexity = 11
                                                                      class Foo {
                                                                      1   public function example() {
                                                                      2       if ($a == $b) {
                                                                      3           if ($a1 == $b1) {
                                                                                      fiddle();
                                                                      4           } elseif ($a2 == $b2) {
                                                                                      fiddle();
                                                                                  } else {
                                                                                      fiddle();
                                                                                  }
                                                                      5       } elseif ($c == $d) {
                                                                      6           while ($c == $d) {
                                                                                      fiddle();
                                                                                  }
                                                                      7        } elseif ($e == $f) {
                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                      fiddle();
                                                                                  }
                                                                              } else {
                                                                                  switch ($z) {
                                                                      9               case 1:
                                                                                          fiddle();
                                                                                          break;
                                                                      10              case 2:
                                                                                          fiddle();
                                                                                          break;
                                                                      11              case 3:
                                                                                          fiddle();
                                                                                          break;
                                                                                      default:
                                                                                          fiddle();
                                                                                          break;
                                                                                  }
                                                                              }
                                                                          }
                                                                      }

                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                      The method getAttributes() has a Cyclomatic Complexity of 15. The configured cyclomatic complexity threshold is 10.
                                                                      Open

                                                                          public function getAttributes(array $options = []): array
                                                                          {
                                                                              $defaults = [
                                                                                  'zone'      => null,
                                                                                  'parent'    => null,

                                                                      CyclomaticComplexity

                                                                      Since: 0.1

                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                      Example

                                                                      // Cyclomatic Complexity = 11
                                                                      class Foo {
                                                                      1   public function example() {
                                                                      2       if ($a == $b) {
                                                                      3           if ($a1 == $b1) {
                                                                                      fiddle();
                                                                      4           } elseif ($a2 == $b2) {
                                                                                      fiddle();
                                                                                  } else {
                                                                                      fiddle();
                                                                                  }
                                                                      5       } elseif ($c == $d) {
                                                                      6           while ($c == $d) {
                                                                                      fiddle();
                                                                                  }
                                                                      7        } elseif ($e == $f) {
                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                      fiddle();
                                                                                  }
                                                                              } else {
                                                                                  switch ($z) {
                                                                      9               case 1:
                                                                                          fiddle();
                                                                                          break;
                                                                      10              case 2:
                                                                                          fiddle();
                                                                                          break;
                                                                      11              case 3:
                                                                                          fiddle();
                                                                                          break;
                                                                                      default:
                                                                                          fiddle();
                                                                                          break;
                                                                                  }
                                                                              }
                                                                          }
                                                                      }

                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                      The method setUserValue2() has a Cyclomatic Complexity of 17. The configured cyclomatic complexity threshold is 10.
                                                                      Open

                                                                          public function setUserValue2(int $uid, int $attributeId, int $itemId, $value, bool $empty): void
                                                                          {
                                                                              $attribute = $this->getAttribute($attributeId);
                                                                              if (! $attribute) {
                                                                                  throw new Exception("attribute `$attributeId` not found");

                                                                      CyclomaticComplexity

                                                                      Since: 0.1

                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                      Example

                                                                      // Cyclomatic Complexity = 11
                                                                      class Foo {
                                                                      1   public function example() {
                                                                      2       if ($a == $b) {
                                                                      3           if ($a1 == $b1) {
                                                                                      fiddle();
                                                                      4           } elseif ($a2 == $b2) {
                                                                                      fiddle();
                                                                                  } else {
                                                                                      fiddle();
                                                                                  }
                                                                      5       } elseif ($c == $d) {
                                                                      6           while ($c == $d) {
                                                                                      fiddle();
                                                                                  }
                                                                      7        } elseif ($e == $f) {
                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                      fiddle();
                                                                                  }
                                                                              } else {
                                                                                  switch ($z) {
                                                                      9               case 1:
                                                                                          fiddle();
                                                                                          break;
                                                                      10              case 2:
                                                                                          fiddle();
                                                                                          break;
                                                                      11              case 3:
                                                                                          fiddle();
                                                                                          break;
                                                                                      default:
                                                                                          fiddle();
                                                                                          break;
                                                                                  }
                                                                              }
                                                                          }
                                                                      }

                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                      The method calcInheritedValue() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
                                                                      Open

                                                                          private function calcInheritedValue($attribute, int $itemId): array
                                                                          {
                                                                              $actualValue = [
                                                                                  'empty' => true,
                                                                                  'value' => null,

                                                                      CyclomaticComplexity

                                                                      Since: 0.1

                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                      Example

                                                                      // Cyclomatic Complexity = 11
                                                                      class Foo {
                                                                      1   public function example() {
                                                                      2       if ($a == $b) {
                                                                      3           if ($a1 == $b1) {
                                                                                      fiddle();
                                                                      4           } elseif ($a2 == $b2) {
                                                                                      fiddle();
                                                                                  } else {
                                                                                      fiddle();
                                                                                  }
                                                                      5       } elseif ($c == $d) {
                                                                      6           while ($c == $d) {
                                                                                      fiddle();
                                                                                  }
                                                                      7        } elseif ($e == $f) {
                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                      fiddle();
                                                                                  }
                                                                              } else {
                                                                                  switch ($z) {
                                                                      9               case 1:
                                                                                          fiddle();
                                                                                          break;
                                                                      10              case 2:
                                                                                          fiddle();
                                                                                          break;
                                                                      11              case 3:
                                                                                          fiddle();
                                                                                          break;
                                                                                      default:
                                                                                          fiddle();
                                                                                          break;
                                                                                  }
                                                                              }
                                                                          }
                                                                      }

                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                      The method calcAvgUserValue() has a Cyclomatic Complexity of 17. The configured cyclomatic complexity threshold is 10.
                                                                      Open

                                                                          private function calcAvgUserValue(array $attribute, int $itemId): array
                                                                          {
                                                                              $userValuesDataTable = $this->getUserValueDataTable($attribute['typeId']);
                                                                      
                                                                              $userValueDataRows = $userValuesDataTable->select([

                                                                      CyclomaticComplexity

                                                                      Since: 0.1

                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                      Example

                                                                      // Cyclomatic Complexity = 11
                                                                      class Foo {
                                                                      1   public function example() {
                                                                      2       if ($a == $b) {
                                                                      3           if ($a1 == $b1) {
                                                                                      fiddle();
                                                                      4           } elseif ($a2 == $b2) {
                                                                                      fiddle();
                                                                                  } else {
                                                                                      fiddle();
                                                                                  }
                                                                      5       } elseif ($c == $d) {
                                                                      6           while ($c == $d) {
                                                                                      fiddle();
                                                                                  }
                                                                      7        } elseif ($e == $f) {
                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                      fiddle();
                                                                                  }
                                                                              } else {
                                                                                  switch ($z) {
                                                                      9               case 1:
                                                                                          fiddle();
                                                                                          break;
                                                                      10              case 2:
                                                                                          fiddle();
                                                                                          break;
                                                                      11              case 3:
                                                                                          fiddle();
                                                                                          break;
                                                                                      default:
                                                                                          fiddle();
                                                                                          break;
                                                                                  }
                                                                              }
                                                                          }
                                                                      }

                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                      The method valueToText() has a Cyclomatic Complexity of 16. The configured cyclomatic complexity threshold is 10.
                                                                      Open

                                                                          private function valueToText(array $attribute, $value, string $language)
                                                                          {
                                                                              if ($value === null) {
                                                                                  return null;
                                                                              }

                                                                      CyclomaticComplexity

                                                                      Since: 0.1

                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                      Example

                                                                      // Cyclomatic Complexity = 11
                                                                      class Foo {
                                                                      1   public function example() {
                                                                      2       if ($a == $b) {
                                                                      3           if ($a1 == $b1) {
                                                                                      fiddle();
                                                                      4           } elseif ($a2 == $b2) {
                                                                                      fiddle();
                                                                                  } else {
                                                                                      fiddle();
                                                                                  }
                                                                      5       } elseif ($c == $d) {
                                                                      6           while ($c == $d) {
                                                                                      fiddle();
                                                                                  }
                                                                      7        } elseif ($e == $f) {
                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                      fiddle();
                                                                                  }
                                                                              } else {
                                                                                  switch ($z) {
                                                                      9               case 1:
                                                                                          fiddle();
                                                                                          break;
                                                                      10              case 2:
                                                                                          fiddle();
                                                                                          break;
                                                                      11              case 3:
                                                                                          fiddle();
                                                                                          break;
                                                                                      default:
                                                                                          fiddle();
                                                                                          break;
                                                                                  }
                                                                              }
                                                                          }
                                                                      }

                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                      The method getZoneItemsActualValues() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
                                                                      Open

                                                                          private function getZoneItemsActualValues(int $zoneId, array $itemIds): array
                                                                          {
                                                                              if (count($itemIds) <= 0) {
                                                                                  return [];
                                                                              }

                                                                      CyclomaticComplexity

                                                                      Since: 0.1

                                                                      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                                                      Example

                                                                      // Cyclomatic Complexity = 11
                                                                      class Foo {
                                                                      1   public function example() {
                                                                      2       if ($a == $b) {
                                                                      3           if ($a1 == $b1) {
                                                                                      fiddle();
                                                                      4           } elseif ($a2 == $b2) {
                                                                                      fiddle();
                                                                                  } else {
                                                                                      fiddle();
                                                                                  }
                                                                      5       } elseif ($c == $d) {
                                                                      6           while ($c == $d) {
                                                                                      fiddle();
                                                                                  }
                                                                      7        } elseif ($e == $f) {
                                                                      8           for ($n = 0; $n < $h; $n++) {
                                                                                      fiddle();
                                                                                  }
                                                                              } else {
                                                                                  switch ($z) {
                                                                      9               case 1:
                                                                                          fiddle();
                                                                                          break;
                                                                      10              case 2:
                                                                                          fiddle();
                                                                                          break;
                                                                      11              case 3:
                                                                                          fiddle();
                                                                                          break;
                                                                                      default:
                                                                                          fiddle();
                                                                                          break;
                                                                                  }
                                                                              }
                                                                          }
                                                                      }

                                                                      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                                                      The class SpecificationsService has a coupling between objects value of 22. Consider to reduce the number of dependencies under 13.
                                                                      Open

                                                                      class SpecificationsService
                                                                      {
                                                                          private const
                                                                              DEFAULT_ZONE_ID = 1,
                                                                              ENGINE_ZONE_ID  = 5,

                                                                      CouplingBetweenObjects

                                                                      Since: 1.1.0

                                                                      A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

                                                                      Example

                                                                      class Foo {
                                                                          /**
                                                                           * @var \foo\bar\X
                                                                           */
                                                                          private $x = null;
                                                                      
                                                                          /**
                                                                           * @var \foo\bar\Y
                                                                           */
                                                                          private $y = null;
                                                                      
                                                                          /**
                                                                           * @var \foo\bar\Z
                                                                           */
                                                                          private $z = null;
                                                                      
                                                                          public function setFoo(\Foo $foo) {}
                                                                          public function setBar(\Bar $bar) {}
                                                                          public function setBaz(\Baz $baz) {}
                                                                      
                                                                          /**
                                                                           * @return \SplObjectStorage
                                                                           * @throws \OutOfRangeException
                                                                           * @throws \InvalidArgumentException
                                                                           * @throws \ErrorException
                                                                           */
                                                                          public function process(\Iterator $it) {}
                                                                      
                                                                          // ...
                                                                      }

                                                                      Source https://phpmd.org/rules/design.html#couplingbetweenobjects

                                                                      The method specifications uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                              } else {
                                                                                  $keys        = array_keys($zoneIds);
                                                                                  $specsZoneId = reset($keys);
                                                                              }

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method getZoneItemsActualValues uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                                          } else {
                                                                                              $values[$id][$aid] = $value;
                                                                                          }

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method refreshConflictFlag uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                                      } else {
                                                                                          $weight = self::WEIGHT_NONE;
                                                                                      }

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method getActualValueText uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                              } else {
                                                                                  return $this->valueToText($attribute, $value, $language);
                                                                              }

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method refreshConflictFlag uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                              } else {
                                                                                  $affectedRows = $this->userValueTable->update([
                                                                                      'conflict' => 0,
                                                                                      'weight'   => self::WEIGHT_NONE,
                                                                                  ], [

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method specifications uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                              } else {
                                                                                  $actualValues = $this->getItemsActualValues($carIds);
                                                                              }

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method setUserValue uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                                      } else {
                                                                                          $valueChanged = true;
                                                                                      }

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method setActualValue uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                              } else {
                                                                                  $primaryKey = [
                                                                                      'attribute_id' => $attribute['id'],
                                                                                      'item_id'      => $itemId,
                                                                                  ];

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method setUserValue2 uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                              } else {
                                                                                  if (strlen($value) > 0 || $empty) {
                                                                                      // insert/update value descriptor
                                                                                      $userValue = currentFromResultSetInterface($this->userValueTable->select($userValuePrimaryKey));
                                                                      
                                                                      

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method specPicture uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                              } else {
                                                                                  $order[] = 'pictures.id desc';
                                                                              }

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method getAttributes uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                              } else {
                                                                                  if ($zone) {
                                                                                      $attributes = [];
                                                                                      if ($parent !== null) {
                                                                                          $ids = [];

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method calcEngineValue uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                              } else {
                                                                                  $valueDataRows = $valueDataTable->select([
                                                                                      'attribute_id' => $attribute['id'],
                                                                                      'item_id'      => $carRow['engine_item_id'],
                                                                                      'value IS NOT NULL',

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method calcEngineValue uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                                  } else {
                                                                                      return [
                                                                                          'empty' => true,
                                                                                          'value' => null,
                                                                                      ];

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method setUserValue2 uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                                  } else {
                                                                                      // delete value descriptor
                                                                                      $affected = $this->userValueTable->delete($userValuePrimaryKey);
                                                                                      // remove value
                                                                                      $affected += $userValueDataTable->delete($userValuePrimaryKey);

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method getAttributes uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                                      } else {
                                                                                          $attributes = $this->attributes;
                                                                                      }

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method valueToText uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                                          } else {
                                                                                              return $this->getListOptionsText($attribute['id'], $value);
                                                                                          }

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method setActualValue uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                                  } else {
                                                                                      $params = [
                                                                                          'value'        => $actualValue['value'],
                                                                                          'attribute_id' => $attribute['id'],
                                                                                          'item_id'      => $itemId,

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method getUserValueText uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                                  } else {
                                                                                      return $values[0];
                                                                                  }

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method loadAttributes uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                                      } else {
                                                                                          $childs[$pid][] = $id;
                                                                                      }

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method getAttributes uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                                  } else {
                                                                                      if ($parent !== null) {
                                                                                          foreach ($this->childs[$parent] as $id) {
                                                                                              $attributes[] = $this->attributes[$id];
                                                                                          }

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method setUserValue2 uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                                      } else {
                                                                                          $valueChanged = true;
                                                                                      }

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method getAttributes uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                                  } else {
                                                                                      if (isset($this->childs[$parent])) {
                                                                                          $ids = $this->childs[$parent];
                                                                                      }
                                                                                  }

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method getUserValueWeight uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                                  } else {
                                                                                      $this->valueWeights[$userId] = 1;
                                                                                  }

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method loadListOptions uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                                      } else {
                                                                                          $this->listOptionsChilds[$aid][$pid][] = $id;
                                                                                      }

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method setUserValue uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                              } else {
                                                                                  if (strlen($value) > 0) {
                                                                                      // insert/update value decsriptor
                                                                                      $userValue = currentFromResultSetInterface($this->userValueTable->select($userValuePrimaryKey));
                                                                      
                                                                      

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method setUserValue uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                                          } else {
                                                                                              $userValueDataTable->insert(array_merge($set, $userValuePrimaryKey));
                                                                                          }

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method setUserValue uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                                  } else {
                                                                                      // delete value descriptor
                                                                                      $affected = $this->userValueTable->delete($userValuePrimaryKey);
                                                                                      // remove value
                                                                                      $affected += $userValueDataTable->delete($userValuePrimaryKey);

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method calcEngineValue uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                                  } else {
                                                                                      return [
                                                                                          'empty' => true,
                                                                                          'value' => null,
                                                                                      ];

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method getAttributes uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                                      } else {
                                                                                          $ids = $this->zoneAttrs[$zone];
                                                                                      }

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method calcAvgUserValue uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                                  } else {
                                                                                      $value = null;
                                                                                      foreach ($valueRows as $valueRow) {
                                                                                          $value = $valueRow['value'];
                                                                                      }

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method setUserValue uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                                          } else {
                                                                                              $this->userValueTable->update([
                                                                                                  'update_date' => new Sql\Expression('NOW()'),
                                                                                              ], $userValuePrimaryKey);
                                                                                          }

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method refreshConflictFlag uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                                          } else {
                                                                                              $weight = self::WEIGHT_WRONG;
                                                                                          }

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method getActualValue uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                              } else {
                                                                                  $row = currentFromResultSetInterface($valuesTable->selectWith($select));
                                                                      
                                                                                  if ($row) {
                                                                                      return $row['value'];

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method removeEmpty uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                                  } else {
                                                                                      $id        = $attribute['id'];
                                                                                      $haveValue = false;
                                                                                      foreach ($cars as $car) {
                                                                                          if (isset($car['values'][$id])) {

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method getItemsActualValues uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                                      } else {
                                                                                          $values[$id][$aid] = $value;
                                                                                      }

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      The method valueToText uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                                                      Open

                                                                                                  } else {
                                                                                                      $text[] = $this->getListOptionsText($attribute['id'], $v);
                                                                                                  }

                                                                      ElseExpression

                                                                      Since: 1.4.0

                                                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                                                      Example

                                                                      class Foo
                                                                      {
                                                                          public function bar($flag)
                                                                          {
                                                                              if ($flag) {
                                                                                  // one branch
                                                                              } else {
                                                                                  // another branch
                                                                              }
                                                                          }
                                                                      }

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

                                                                      TODO found
                                                                      Open

                                                                                  // TODO: multiple attr inheritance

                                                                      syntax error, unexpected 'TableGateway' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)
                                                                      Open

                                                                          private TableGateway $attributeTable;

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

                                                                          public function __construct(
                                                                              TranslatorInterface $translator,
                                                                              ItemNameFormatter $itemNameFormatter,
                                                                              Item $itemModel,
                                                                              ItemParent $itemParent,
                                                                      Severity: Major
                                                                      Found in module/Application/src/Service/SpecificationsService.php and 1 other location - About 1 day to fix
                                                                      module/Application/src/Controller/Api/PictureController.php on lines 114..161

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

                                                                      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

                                                                          public function getSpecsCount(int $itemId): int
                                                                          {
                                                                              $select = new Sql\Select($this->valueTable->getTable());
                                                                              $select->columns(['count' => new Sql\Expression('count(1)')])
                                                                                  ->where(['item_id' => $itemId]);
                                                                      Severity: Major
                                                                      Found in module/Application/src/Service/SpecificationsService.php and 2 other locations - About 55 mins to fix
                                                                      module/Application/src/Model/ItemParent.php on lines 899..907
                                                                      module/Application/src/Model/ItemParent.php on lines 912..920

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

                                                                      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

                                                                      There are no issues that match your filters.

                                                                      Category
                                                                      Status