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

View on GitHub

Showing 77 of 387 total issues

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

    public function __construct(
        SchemaProcessor $schemaProcessor,
        Schema $schema,
        string $pattern,
        JsonSchema $propertyStructure,
Severity: Minor
Found in src/Model/Validator/PatternPropertiesValidator.php - About 1 hr to fix

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

        public function process(string $propertyName, JsonSchema $propertySchema): PropertyInterface
        {
            $path = [];
            $reference = $propertySchema->getJson()['$ref'];
            $dictionary = $this->schema->getSchemaDictionary();
    Severity: Minor
    Found in src/PropertyProcessor/Property/ReferenceProcessor.php - About 1 hr to fix

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

          protected function addEnumValidator(PropertyInterface $property, array $allowedValues): void
          {
              if (empty($allowedValues)) {
                  throw new SchemaException(
                      sprintf(
      Severity: Minor
      Found in src/PropertyProcessor/Property/AbstractPropertyProcessor.php - About 1 hr to fix

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

            public function __construct(
                SchemaProcessor $schemaProcessor,
                Schema $schema,
                JsonSchema $propertiesStructure,
                string $propertyName,
        Severity: Minor
        Found in src/Model/Validator/ArrayTupleValidator.php - About 1 hr to fix

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

              private function addTransformedValuePassThrough(
                  PropertyInterface $property,
                  TransformingFilterInterface $filter,
                  ReflectionType $filteredType,
              ): void {
          Severity: Minor
          Found in src/PropertyProcessor/Filter/FilterProcessor.php - About 1 hr to fix

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

                public function addFilter(FilterInterface ...$additionalFilter): self
                {
                    foreach ($additionalFilter as $filter) {
                        $this->validateFilterCallback(
                            $filter->getFilter(),
            Severity: Minor
            Found in src/Model/GeneratorConfiguration.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 addComposedValueValidator has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function addComposedValueValidator(PropertyInterface $property, JsonSchema $propertySchema): void
                {
                    $composedValueKeywords = ['allOf', 'anyOf', 'oneOf', 'not', 'if'];
                    $propertyFactory = new PropertyFactory(new ComposedValueProcessorFactory($property instanceof BaseProperty));
            
            
            Severity: Minor
            Found in src/PropertyProcessor/Property/AbstractPropertyProcessor.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 transferComposedPropertiesToSchema has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function transferComposedPropertiesToSchema(PropertyInterface $property): void
                {
                    foreach ($property->getValidators() as $validator) {
                        $validator = $validator->getValidator();
            
            
            Severity: Minor
            Found in src/PropertyProcessor/Property/BaseProcessor.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 resolveReference has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                public function resolveReference(
                    string $propertyName,
                    array $path,
                    PropertyMetaDataCollection $propertyMetaDataCollection,
                ): PropertyInterface {
            Severity: Minor
            Found in src/Model/SchemaDefinition/SchemaDefinition.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 processSubProperties has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function processSubProperties(
                    string $propertyName,
                    JsonSchema $propertySchema,
                    PropertyInterface $property,
                ): array {
            Severity: Minor
            Found in src/PropertyProcessor/Property/MultiTypeProcessor.php - About 55 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Method __construct has 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

              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;

                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

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

                              GeneratorConfiguration $generatorConfiguration,
                              FilterInterface $filter,
                              PropertyInterface $property,
                              array $filterOptions = [],
                              ?TransformingFilterInterface $transformingFilter = null,
                      Severity: Minor
                      Found in src/Model/Validator/FilterValidator.php - About 35 mins to fix

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

                                string $classPath,
                                string $className,
                                JsonSchema $jsonSchema,
                                SchemaDefinitionDictionary $dictionary,
                                bool $initialClass,
                        Severity: Minor
                        Found in src/SchemaProcessor/SchemaProcessor.php - About 35 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language