Function detectMalware
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
function detectMalware($filePath, &$foundFragment, &$pos, $startTime, $timeout, $ext)
{
if (filesize($filePath) > $this->MAX_FILESIZE) {
return 'skipped';
- 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
File MalwareDetector.inc.php
has 327 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
ob_start();
require_once('XmlValidator.inc.php');
require_once('FileInfo.inc.php');
Method detectMalware
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
function detectMalware($filePath, &$foundFragment, &$pos, $startTime, $timeout, $ext)
{
if (filesize($filePath) > $this->MAX_FILESIZE) {
return 'skipped';
Function malwareScanRound
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
function malwareScanRound()
{
global $php_errormsg;
- 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 malwareScanRound
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
function malwareScanRound()
{
global $php_errormsg;
Method repackXMLLog
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function repackXMLLog()
{
global $projectRootDir;
$xmlLogFilename = $this->XML_LOG_FILENAME;
Function checkForValidPhp
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function checkForValidPhp($content)
{
$len = strlen($content);
$start = 0;
$valid = false;
- 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 repackXMLLog
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function repackXMLLog()
{
global $projectRootDir;
$xmlLogFilename = $this->XML_LOG_FILENAME;
- 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 detectMalware
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function detectMalware($filePath, &$foundFragment, &$pos, $startTime, $timeout, $ext)
Avoid too many return
statements within this method. Open
return $attrSeverity;
Function buildQuarantineArchive
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function buildQuarantineArchive()
{
if (file_exists($this->MALWARE_QUARANTINE_FILENAME)) {
$list = file($this->MALWARE_QUARANTINE_FILENAME);
- 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"