Showing 7 of 14 total issues
Method checkParamValue
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function checkParamValue(array $param)
{
if ($param['type'] === 'array') {
$this->checkItems($param);
Method check
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function check(array $param)
{
if (!is_string($param['value'])) {
throw new ValidationException('Value is not a string');
}
Function check
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function check(array $param)
{
if (!is_string($param['value'])) {
throw new ValidationException('Value is not a string');
}
- Read upRead up
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 check
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function check(array $param)
{
if (!filter_var($param['value'], FILTER_VALIDATE_INT)) {
throw new ValidationException('Value is not an integer');
}
- Read upRead up
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;
Function checkRange
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function checkRange(array $param)
{
if (isset($param['maximum']) && $param['value'] > $param['maximum']) {
throw new ValidationException('Value exceeds maximum');
}
- Read upRead up
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 checkItems
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function checkItems(array $param)
{
if (isset($param['maxItems']) && $param['maxItems'] < count($param['value'])) {
throw new ValidationException('Size of array exceeds maxItems');
}
- Read upRead up
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"