File minfraud.body.php
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Wikimedia Foundation
*
* LICENSE
Method canBypassMinFraud
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function canBypassMinFraud() {
// if the data bits data_hash and action are not set, we need to hit minFraud
$localdata = $this->gateway_adapter->getData_Unstaged_Escaped();
if ( !isset( $localdata['data_hash'] ) || !strlen(
$localdata['data_hash']
Method filter
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function filter() {
// see if we can bypass minFraud
if ( $this->canBypassMinFraud() ) {
return true;
}
Function withExtraFields
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function withExtraFields( $data, $query ) {
foreach ( self::$extraFieldsMap as $section => $fields ) {
foreach ( $fields as $ourName => $theirName ) {
if ( in_array( $ourName, $this->enabledExtraFields ) ) {
if ( !empty( $data[$ourName] ) ) {
- 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 healthCheck
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function healthCheck( Score $response ) {
global $wgEmergencyContact;
if ( isset( $response->queriesRemaining ) ) {
$queries = intval( $response->queriesRemaining );
- 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 canBypassMinFraud
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function canBypassMinFraud() {
// if the data bits data_hash and action are not set, we need to hit minFraud
$localdata = $this->gateway_adapter->getData_Unstaged_Escaped();
if ( !isset( $localdata['data_hash'] ) || !strlen(
$localdata['data_hash']
- 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"