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

View on GitHub

Showing 77 of 387 total issues

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

        PropertyInterface $property,
        string $template,
        array $templateValues,
        string $exceptionClass,
        array $exceptionParams = [],
Severity: Minor
Found in src/Model/Validator/PropertyTemplateValidator.php - About 35 mins to fix

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

            PropertyMetaDataCollection $propertyMetaDataCollection,
            SchemaProcessor $schemaProcessor,
            Schema $schema,
            string $propertyName,
            JsonSchema $propertySchema,
    Severity: Minor
    Found in src/PropertyProcessor/PropertyFactory.php - About 35 mins to fix

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

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

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

                PropertyProcessorFactory $propertyProcessorFactory,
                array $types,
                PropertyMetaDataCollection $propertyMetaDataCollection,
                SchemaProcessor $schemaProcessor,
                Schema $schema,
        Severity: Minor
        Found in src/PropertyProcessor/Property/MultiTypeProcessor.php - About 35 mins to fix

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

                  GeneratorConfiguration $generatorConfiguration,
                  JsonSchema $jsonSchema,
                  string $name,
                  array $values,
                  ?array $map,
          Severity: Minor
          Found in src/SchemaProcessor/PostProcessor/EnumPostProcessor.php - About 35 mins to fix

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

                protected function transferValidators(PropertyInterface $source, PropertyInterface $destination)
                {
                    foreach ($source->getValidators() as $validatorContainer) {
                        $validator = $validatorContainer->getValidator();
            
            
            Severity: Minor
            Found in src/PropertyProcessor/Property/MultiTypeProcessor.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 process has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function process(Schema $schema, GeneratorConfiguration $generatorConfiguration): void
                {
                    $json = $schema->getJsonSchema()->getJson();
            
                    if (!isset($json['patternProperties'])) {

            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 $this->properties;
            Severity: Major
            Found in src/Model/Schema.php - About 30 mins to fix

              Function process has a Cognitive Complexity of 6 (exceeds 5 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 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 hash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function hash(array $array, array $relevantFields = []): string
                  {
                      if ($relevantFields) {
                          foreach ($array as $key => $_) {
                              if (!in_array($key, $relevantFields)) {
              Severity: Minor
              Found in src/Utils/ArrayHash.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 addAdditionalPropertiesCollectionProperty has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function addAdditionalPropertiesCollectionProperty(Schema $schema): void
                  {
                      $validationProperty = null;
                      foreach ($schema->getBaseValidators() as $validator) {
                          if (is_a($validator, AdditionalPropertiesValidator::class)) {

              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 redirectMergedProperty has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function redirectMergedProperty(array $compositionProperties)
                  {
                      $redirectToProperty = null;
                      foreach ($compositionProperties as $property) {
                          if ($property->getNestedSchema()) {
              Severity: Minor
              Found in src/SchemaProcessor/SchemaProcessor.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 generateValidators has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function generateValidators(PropertyInterface $property, JsonSchema $propertySchema): void
                  {
                      parent::generateValidators($property, $propertySchema);
              
                      $this->addLengthValidation($property, $propertySchema);
              Severity: Minor
              Found in src/PropertyProcessor/Property/ArrayProcessor.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 addEnumValidator has a Cognitive Complexity of 6 (exceeds 5 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 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 validateFilterCompatibilityWithBaseType has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function validateFilterCompatibilityWithBaseType(FilterInterface $filter, PropertyInterface $property)
                  {
                      if (empty($filter->getAcceptedTypes()) || !$property->getType()) {
                          return;
                      }
              Severity: Minor
              Found in src/Model/Validator/FilterValidator.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 inheritIfPropertyType has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function inheritIfPropertyType(JsonSchema $propertySchema): JsonSchema
                  {
                      $json = $propertySchema->getJson();
              
                      foreach (['if', 'then', 'else'] as $composedValueKeyword) {
              Severity: Minor
              Found in src/PropertyProcessor/Property/AbstractPropertyProcessor.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 generateValidators has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function generateValidators(PropertyInterface $property, JsonSchema $propertySchema): void
                  {
                      $json = $propertySchema->getJson()['propertySchema']->getJson();
              
                      if (!isset($json['then']) && !isset($json['else'])) {
              Severity: Minor
              Found in src/PropertyProcessor/ComposedValue/IfProcessor.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

              Severity
              Category
              Status
              Source
              Language