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

View on GitHub

Showing 387 of 387 total issues

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

        GeneratorConfiguration $generatorConfiguration,
        PropertyInterface $property,
        string $template,
        array $templateValues,
        string $exceptionClass,
Severity: Minor
Found in src/Model/Validator/ExtractedMethodValidator.php - About 45 mins to fix

    Function inheritPropertyType has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function inheritPropertyType(JsonSchema $propertySchema, string $composedValueKeyword): JsonSchema
        {
            $json = $propertySchema->getJson();
    
            if (!isset($json['type'])) {
    Severity: Minor
    Found in src/PropertyProcessor/Property/AbstractPropertyProcessor.php - About 45 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 getDefinition has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getDefinition(string $key, SchemaProcessor $schemaProcessor, array &$path = []): ?SchemaDefinition
        {
            if (strpos($key, '#') === 0 && strpos($key, '/')) {
                $path = explode('/', $key);
                array_shift($path);
    Severity: Minor
    Found in src/Model/SchemaDefinition/SchemaDefinitionDictionary.php - About 45 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 renderEnum has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        private function renderEnum(
            GeneratorConfiguration $generatorConfiguration,
            JsonSchema $jsonSchema,
            string $name,
            array $values,
    Severity: Minor
    Found in src/SchemaProcessor/PostProcessor/EnumPostProcessor.php - About 45 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 class FilterProcessor has a coupling between objects value of 19. Consider to reduce the number of dependencies under 13.
    Open

    class FilterProcessor
    {
        /**
         * @param PropertyInterface $property
         * @param mixed $filterList

    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 class BaseProcessor has a coupling between objects value of 25. Consider to reduce the number of dependencies under 13.
    Open

    class BaseProcessor extends AbstractPropertyProcessor
    {
        protected const TYPE = 'object';
    
        private const COUNT_PROPERTIES =

    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

    Consider simplifying this complex logical expression.
    Open

            if ((!$this->addForModelsWithoutAdditionalPropertiesDefinition && !isset($json['additionalProperties']))
                || (isset($json['additionalProperties']) && $json['additionalProperties'] === false)
                || (!isset($json['additionalProperties']) && $generatorConfiguration->denyAdditionalProperties())
            ) {
                return;

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

      abstract class AbstractPropertyProcessor implements PropertyProcessorInterface
      {
          /** @var PropertyMetaDataCollection */
          protected $propertyMetaDataCollection;
          /** @var SchemaProcessor */

      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 class ModelGenerator has a coupling between objects value of 16. Consider to reduce the number of dependencies under 13.
      Open

      class ModelGenerator
      {
          /** @var GeneratorConfiguration */
          protected $generatorConfiguration;
          /** @var PostProcessor[] */
      Severity: Minor
      Found in src/ModelGenerator.php by phpmd

      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 class ArrayProcessor has a coupling between objects value of 22. Consider to reduce the number of dependencies under 13.
      Open

      class ArrayProcessor extends AbstractTypedValueProcessor
      {
          protected const TYPE = 'array';
      
          private const JSON_FIELD_MIN_ITEMS = 'minItems';

      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 class MultiTypeProcessor has a coupling between objects value of 14. Consider to reduce the number of dependencies under 13.
      Open

      class MultiTypeProcessor extends AbstractValueProcessor
      {
          /** @var PropertyProcessorInterface[] */
          protected $propertyProcessors = [];
          /** @var string[] */

      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 class EnumPostProcessor has a coupling between objects value of 19. Consider to reduce the number of dependencies under 13.
      Open

      class EnumPostProcessor extends PostProcessor
      {
          private $generatedEnums = [];
      
          /** @var string */

      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 class AdditionalPropertiesAccessorPostProcessor has a coupling between objects value of 17. Consider to reduce the number of dependencies under 13.
      Open

      class AdditionalPropertiesAccessorPostProcessor extends PostProcessor
      {
          /** @var bool */
          private $addForModelsWithoutAdditionalPropertiesDefinition;
      
      

      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 class SerializationPostProcessor has a coupling between objects value of 16. Consider to reduce the number of dependencies under 13.
      Open

      class SerializationPostProcessor extends PostProcessor
      {
          /**
           * Add serialization support to the provided schema
           *

      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 class SchemaProcessor has a coupling between objects value of 18. Consider to reduce the number of dependencies under 13.
      Open

      class SchemaProcessor
      {
          /** @var GeneratorConfiguration */
          protected $generatorConfiguration;
          /** @var RenderQueue */

      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 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
      {
          /** @var bool */
          private $rootLevelComposition;
          /** @var PropertyInterface|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

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

      class SchemaDefinition
      {
          /** @var JsonSchema */
          protected $source;
          /** @var SchemaProcessor */

      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

      Method addRangeValidator has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              PropertyInterface $property,
              JsonSchema $propertySchema,
              string $field,
              string $check,
              string $exceptionClass,
      Severity: Minor
      Found in src/PropertyProcessor/Property/AbstractNumericProcessor.php - About 35 mins to fix

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

                string $classPath,
                string $className,
                JsonSchema $schema,
                ?SchemaDefinitionDictionary $dictionary = null,
                bool $initialClass = false,
        Severity: Minor
        Found in src/Model/Schema.php - About 35 mins to fix

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

                  GeneratorConfiguration $generatorConfiguration,
                  PropertyInterface $property,
                  array $composedProperties,
                  string $compositionProcessor,
                  array $validatorVariables,
          Severity: Minor
          Found in src/Model/Validator/ComposedPropertyValidator.php - About 35 mins to fix
            Severity
            Category
            Status
            Source
            Language