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

View on GitHub
src/Model/Validator/FilterValidator.php

Summary

Maintainability
A
2 hrs
Test Coverage
A
100%

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

    public function __construct(
        GeneratorConfiguration $generatorConfiguration,
        FilterInterface $filter,
        PropertyInterface $property,
        array $filterOptions = [],
Severity: Minor
Found in src/Model/Validator/FilterValidator.php - About 1 hr 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

      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

      syntax error, unexpected ')', expecting variable (T_VARIABLE)
      Open

          ) {
      Severity: Critical
      Found in src/Model/Validator/FilterValidator.php by phan

      The CASE body must start on the line following the statement
      Open

                      case 'boolean': return 'bool';

      The CASE body must start on the line following the statement
      Open

                      case 'integer': return 'int';

      The CASE body must start on the line following the statement
      Open

                      case 'number': return 'float';

      Terminating statement must be on a line by itself
      Open

                      case 'boolean': return 'bool';

      Terminating statement must be on a line by itself
      Open

                      case 'integer': return 'int';

      Terminating statement must be on a line by itself
      Open

                      case 'number': return 'float';

      The DEFAULT body must start on the line following the statement
      Open

                      default: return $jsonSchemaType;

      Terminating statement must be on a line by itself
      Open

                      default: return $jsonSchemaType;

      Expected 0 spaces after opening bracket; newline found
      Open

              if (

      Opening brace should be on a new line
      Open

          public function addTransformedCheck(TransformingFilterInterface $filter, PropertyInterface $property): self {

      Closing brace must be on a line by itself
      Open

                      case 'integer': return 'int';

      Closing brace must be on a line by itself
      Open

                      case 'number': return 'float';

      Closing brace must be on a line by itself
      Open

                      case 'boolean': return 'bool';

      Closing brace must be on a line by itself
      Open

                      default: return $jsonSchemaType;

      There are no issues that match your filters.

      Category
      Status