wol-soft/php-json-schema-model-generator

View on GitHub
src/PropertyProcessor/ComposedValue/AbstractComposedValueProcessor.php

Summary

Maintainability
A
3 hrs
Test Coverage
A
100%

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

    protected function generateValidators(PropertyInterface $property, JsonSchema $propertySchema): void
    {
        $json = $propertySchema->getJson()['propertySchema']->getJson();

        if (empty($json[$propertySchema->getJson()['type']]) &&

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

        protected function getCompositionProperties(PropertyInterface $property, JsonSchema $propertySchema): array
        {
            $propertyFactory = new PropertyFactory(new PropertyProcessorFactory());
            $compositionProperties = [];
            $json = $propertySchema->getJson()['propertySchema']->getJson();

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

      abstract class AbstractComposedValueProcessor extends AbstractValueProcessor
      {
          private ?PropertyInterface $mergedProperty = null;
      
          /**

      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

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

          private ?PropertyInterface $mergedProperty = null;

      Multi-line function call not indented correctly; expected 32 spaces but found 34
      Open

                                        )

      Line indented incorrectly; expected 8 spaces, found 20
      Open

                          static fn(CompositionPropertyDecorator $property): string =>

      Line indented incorrectly; expected 4 spaces, found 8
      Open

              private bool $rootLevelComposition,

      Expected 0 spaces before closing bracket; newline found
      Open

                      $compositionProperty->filterValidators(static fn(Validator $validator): bool =>

      Multi-line function call not indented correctly; expected 20 spaces but found 24
      Open

                              $property->getType() ? $property->getType()->getName() : '',

      There are no issues that match your filters.

      Category
      Status