Function xlsToArray
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public static function xlsToArray($filename, $limit)
{
/**
PhpOffice can read both file variants just fine if it's
available.
- 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 xlsxToArray
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function xlsxToArray($filename, $limit=0)
{
if (!class_exists('\\PhpOffice\\PhpSpreadsheet\\IOFactory') && !class_exists('\\PHPExcel_IOFactory')) {
return false;
}
Method xlsToArray
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function xlsToArray($filename, $limit)
{
/**
PhpOffice can read both file variants just fine if it's
available.
Function xlsxToArray
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function xlsxToArray($filename, $limit=0)
{
if (!class_exists('\\PhpOffice\\PhpSpreadsheet\\IOFactory') && !class_exists('\\PHPExcel_IOFactory')) {
return 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 excelNoFormula
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function excelNoFormula($str)
{
$str = trim($str);
$first = substr(trim($str), 0, 1);
while ($first == '=' || $first == '@' || $first == '+' || $first == '-') {
- 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 array();
Avoid too many return
statements within this method. Open
return self::txtToArray($filename, $limit);
Avoid too many return
statements within this method. Open
return self::pdfToArray($filename, $limit);
Function txtToArray
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function txtToArray($filename, $limit=0)
{
$fptr = fopen($filename,'r');
if (!$fptr) {
return array();
- 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 csvToArray
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function csvToArray($filename, $limit=0)
{
$fptr = fopen($filename,'r');
if (!$fptr) {
return array();
- 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"