Showing 8 of 16 total issues
Function validateRequest
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function validateRequest(
ServerRequestInterface $request,
ValidationResultInterface $result
): ValidationResultInterface {
$this->logger->info('Start validation');
- 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 validateRequestTiming
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function validateRequestTiming(string $hmac, Antibot $antibot, array $hmacParams): bool
{
// If submission time checks are enabled
if (!empty($this->submissionTimes)) {
list($first, $min, $max) = $this->submissionTimes;
- 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
Method testRequestTimingValidation
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testRequestTimingValidation(): void
{
$session = md5(rand());
$antibot = $this->createAntibot($session);
$hmacValidator = new HmacValidator();
Function validateHoneypotsRecursive
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function validateHoneypotsRecursive(array $honeypots, array $data, Antibot $antibot, $prefix = null): bool
{
// Run through the honeypot configuration
foreach ($honeypots as $name => $config) {
if (is_array($config)) {
- 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
Method testHoneypots
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testHoneypots(): void
{
$renderer = function (InputElement $input, string $html) {
return '<label style="display:none">' . $html . '</label>';
};
Method validateRequestTiming
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function validateRequestTiming(string $hmac, Antibot $antibot, array $hmacParams): bool
{
// If submission time checks are enabled
if (!empty($this->submissionTimes)) {
list($first, $min, $max) = $this->submissionTimes;
Method probeTimedHmac
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
string $hmac,
Antibot $antibot,
array $hmacParams,
int $timestamp,
bool $followUp = false
Method probeTimedHmacAsInitialAndFollowup
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
string $hmac,
Antibot $antibot,
array $hmacParams,
int $timestamp,
int $initial