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';
- Read upRead up
- Exclude checks
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) {
- Read upRead up
- Exclude checks
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 = [
- Read upRead up
- Exclude checks
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(
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
], [
- Exclude checks
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]+)$',
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
sprintf('Schema version [%s] is invalid. It must match the pattern [%s].', $version, self::VALID_PATTERN)
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
if (in_array($property->getName(), ['default', 'overridable', 'description', 'languages', 'deprecated'])) {
- Exclude checks
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)
- Exclude checks
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')]);
- Exclude checks
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.',
- Exclude checks
Line exceeds 120 characters; contains 129 characters Open
eval(sprintf('class %s extends %s {};', $class, array_values($classes)[$i - 1]));
- Exclude checks
Line exceeds 120 characters; contains 146 characters Open
throw new \RuntimeException(sprintf('Recursively requesting schema id "%s" from file "%s".', $e->getMessage(), $currentFile));
- Exclude checks
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));
- Exclude checks
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.');
- Exclude checks
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());
- Exclude checks
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')]);
- Exclude checks
Multi-line function call not indented correctly; expected 8 spaces but found 12 Open
]);
- Exclude checks
Closing parenthesis of a multi-line function call must be on a line by itself Open
]);
- Exclude checks
Multi-line function call not indented correctly; expected 12 spaces but found 8 Open
},
- Exclude checks