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

View on GitHub

Showing 77 of 387 total issues

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

    public function process(
        PropertyInterface $property,
        $filterList,
        GeneratorConfiguration $generatorConfiguration,
        Schema $schema,
Severity: Minor
Found in src/PropertyProcessor/Filter/FilterProcessor.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

GeneratorConfiguration has 28 functions (exceeds 20 allowed). Consider refactoring.
Open

class GeneratorConfiguration
{
    /** @var string */
    protected $namespacePrefix = '';
    /** @var bool */
Severity: Minor
Found in src/Model/GeneratorConfiguration.php - About 3 hrs to fix

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

        public function process(
            PropertyInterface $property,
            $filterList,
            GeneratorConfiguration $generatorConfiguration,
            Schema $schema,
    Severity: Major
    Found in src/PropertyProcessor/Filter/FilterProcessor.php - About 3 hrs to fix

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

          protected function transferPatternPropertiesFilterToProperty(
              Schema $schema,
              GeneratorConfiguration $generatorConfiguration,
          ): void {
              $patternPropertiesValidators = array_filter(

      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

      PropertyProxy has 25 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class PropertyProxy extends AbstractProperty
      {
          /** @var string */
          protected $key;
          /** @var ResolvedDefinitionsCollection */
      Severity: Minor
      Found in src/Model/Property/PropertyProxy.php - About 2 hrs to fix

        Schema has 24 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Schema
        {
            use JsonSchemaTrait;
        
            /** @var string */
        Severity: Minor
        Found in src/Model/Schema.php - About 2 hrs to fix

          Property has 23 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Property extends AbstractProperty
          {
              /** @var PropertyType */
              protected $type;
              /** @var PropertyType|null */
          Severity: Minor
          Found in src/Model/Property/Property.php - About 2 hrs to fix

            Method transferPatternPropertiesFilterToProperty has 60 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function transferPatternPropertiesFilterToProperty(
                    Schema $schema,
                    GeneratorConfiguration $generatorConfiguration,
                ): void {
                    $patternPropertiesValidators = array_filter(

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

                  public function process(Schema $schema, GeneratorConfiguration $generatorConfiguration): void
                  {
                      $generatorConfiguration->addFilter(new EnumFilter());
              
                      foreach ($schema->getProperties() as $property) {
              Severity: Major
              Found in src/SchemaProcessor/PostProcessor/EnumPostProcessor.php - About 2 hrs to fix

                Function addSerializeFunctionsForTransformingFilters has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function addSerializeFunctionsForTransformingFilters(
                        Schema $schema,
                        GeneratorConfiguration $generatorConfiguration,
                    ): void {
                        foreach ($schema->getProperties() as $property) {

                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 addSerializeFunctionsForTransformingFilters has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function addSerializeFunctionsForTransformingFilters(
                        Schema $schema,
                        GeneratorConfiguration $generatorConfiguration,
                    ): void {
                        foreach ($schema->getProperties() as $property) {

                  Method generateValidators has 55 lines of code (exceeds 25 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: Major
                  Found in src/PropertyProcessor/ComposedValue/IfProcessor.php - About 2 hrs to fix

                    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 getCheck has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function getCheck(): string
                          {
                              /**
                               * Add a method to the schema to gather values from a nested object which are modified.
                               * This is required to adopt filter changes to the values which are passed into a merged property
                      Severity: Minor
                      Found in src/Model/Validator/ComposedPropertyValidator.php - About 1 hr to fix

                        Method createMergedProperty has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function createMergedProperty(
                                Schema $schema,
                                PropertyInterface $property,
                                array $compositionProperties,
                                JsonSchema $propertySchema,
                        Severity: Minor
                        Found in src/SchemaProcessor/SchemaProcessor.php - About 1 hr to fix

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

                              public function process(Schema $schema, GeneratorConfiguration $generatorConfiguration): void
                              {
                                  $generatorConfiguration->addFilter(new EnumFilter());
                          
                                  foreach ($schema->getProperties() as $property) {
                          Severity: Minor
                          Found in src/SchemaProcessor/PostProcessor/EnumPostProcessor.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 generateValidatorPropertyMap has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function generateValidatorPropertyMap(Schema $schema, GeneratorConfiguration $generatorConfiguration): array
                              {
                                  $validatorPropertyMap = [];
                          
                                  // get all base validators which are composed value validators and set up a map of affected object properties

                          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 addAdditionalPropertiesSerialization has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function addAdditionalPropertiesSerialization(
                                  Schema $schema,
                                  GeneratorConfiguration $generatorConfiguration,
                              ): void {
                                  $validationProperty = null;

                            Function process has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                            Open

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

                            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 process has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function process(string $propertyName, JsonSchema $propertySchema): PropertyInterface
                                {
                                    $property = parent::process($propertyName, $propertySchema);
                            
                                    $className = $this->schemaProcessor->getGeneratorConfiguration()->getClassNameGenerator()->getClassName(
                            Severity: Minor
                            Found in src/PropertyProcessor/Property/ObjectProcessor.php - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language