gdbots/pbjc-php

View on GitHub

Showing 579 of 579 total issues

The method getFieldDescriptor() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
Open

    private function getFieldDescriptor(SchemaId $schemaId, array $field)
    {
        // force default type to be "string"
        if (!isset($field['type'])) {
            $field['type'] = 'string';
Severity: Minor
Found in src/SchemaParser.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

The method __construct() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
Open

    public function __construct($id, array $parameters = [])
    {
        $this->id = $id instanceof SchemaId ? $id : SchemaId::fromString($id);

        foreach ($parameters as $key => $value) {
Severity: Minor
Found in src/SchemaDescriptor.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

The method parse() has a Cyclomatic Complexity of 17. The configured cyclomatic complexity threshold is 10.
Open

    private function parse(array $data)
    {
        $schemaId = SchemaId::fromString($data['id']);

        $parameters = [
Severity: Minor
Found in src/SchemaParser.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

Only one argument is allowed per line in a multi-line function call
Open

        ], json_encode(

Only one argument is allowed per line in a multi-line function call
Open

            ], [

Line exceeds 120 characters; contains 128 characters
Open

                            'pattern' => '^pbj:([a-z0-9-]+):([a-z0-9\\.-]+):([a-z0-9-]+)?:([a-z0-9-]+):([0-9]+-[0-9]+-[0-9]+)$',
Severity: Minor
Found in tests/JsonValidatorTest.php by phpcodesniffer

Line exceeds 120 characters; contains 121 characters
Open

                sprintf('Schema version [%s] is invalid. It must match the pattern [%s].', $version, self::VALID_PATTERN)
Severity: Minor
Found in src/SchemaVersion.php by phpcodesniffer

Line exceeds 120 characters; contains 127 characters
Open

                    if (in_array($property->getName(), ['default', 'overridable', 'description', 'languages', 'deprecated'])) {

Line exceeds 120 characters; contains 128 characters
Open

        $this->precision = NumberUtils::bound($this->precision, 0, 65); // range 1-65 (we use 0 to ignore when generating class)
Severity: Minor
Found in src/FieldDescriptor.php by phpcodesniffer

Line exceeds 120 characters; contains 165 characters
Open

        $a = new SchemaDescriptor('pbj:vendor:package:category:message:1-0-0', ['extends' => new SchemaDescriptor('pbj:vendor2:package2:category2:message2:1-0-0')]);

Line exceeds 120 characters; contains 122 characters
Open

                    'The schema "%s" field "%s" enum value "%s" doesn\'t exist. Check enum "%s" for all existing values.',

Line exceeds 120 characters; contains 129 characters
Open

                                                eval(sprintf('class %s extends %s {};', $class, array_values($classes)[$i - 1]));

Line exceeds 120 characters; contains 146 characters
Open

                    throw new \RuntimeException(sprintf('Recursively requesting schema id "%s" from file "%s".', $e->getMessage(), $currentFile));
Severity: Minor
Found in src/Compiler.php by phpcodesniffer

Line exceeds 120 characters; contains 128 characters
Open

        $schemaIds = preg_grep(sprintf('/(%s):([0-9]+)-([0-9]+)-([0-9]+)/', $schemaId->getCurie()), array_keys(self::$schemas));
Severity: Minor
Found in src/SchemaStore.php by phpcodesniffer

Line exceeds 120 characters; contains 133 characters
Open

                throw new \InvalidArgumentException('The schemaOrCallable argument has to be a valid path to XSD file or callable.');
Severity: Minor
Found in src/Util/XmlUtils.php by phpcodesniffer

Line exceeds 120 characters; contains 153 characters
Open

        $this->assertEquals('pbj:vendor2:package2:category2:message2:1-0-0', $this->schema->getMixin('vendor2:package2:category2:message2:v1')->getId());

Line exceeds 120 characters; contains 165 characters
Open

        $b = new SchemaDescriptor('pbj:vendor:package:category:message:1-0-1', ['extends' => new SchemaDescriptor('pbj:vendor3:package3:category3:message3:1-0-0')]);

Multi-line function call not indented correctly; expected 8 spaces but found 12
Open

            ]);

Closing parenthesis of a multi-line function call must be on a line by itself
Open

            ]);

Multi-line function call not indented correctly; expected 12 spaces but found 8
Open

        },
Severity: Minor
Found in src/SchemaDescriptor.php by phpcodesniffer
Severity
Category
Status
Source
Language