Showing 51 of 53 total issues
Method determineNumberFormatType
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function determineNumberFormatType($num_format)
{
$num_format = preg_replace("/\[(Black|Blue|Cyan|Green|Magenta|Red|White|Yellow)\]/i", "", $num_format);
if ($num_format == 'GENERAL') {
return 'n_auto';
Function determineNumberFormatType
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private static function determineNumberFormatType($num_format)
{
$num_format = preg_replace("/\[(Black|Blue|Cyan|Green|Magenta|Red|White|Yellow)\]/i", "", $num_format);
if ($num_format == 'GENERAL') {
return 'n_auto';
- 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 writeSheetHeader
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function writeSheetHeader($sheet_name, array $header_types, $col_options = null)
{
if (empty($sheet_name) || empty($header_types) || !empty($this->sheets[$sheet_name])) {
return;
}
Method finalizeSheet
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function finalizeSheet($sheet_name)
{
if (empty($sheet_name) || $this->sheets[$sheet_name]->finalized) {
return;
}
Method csvFromResource
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function csvFromResource($resource, array $options = []): array
{
if (!is_resource($resource)) {
throw new \InvalidArgumentException("The provided resource is not a valid resource.");
}
Method buildWorkbookXML
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function buildWorkbookXML()
{
$i = 0;
$workbook_xml = "";
$workbook_xml .= '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' . "\n";
Function initializeSheet
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function initializeSheet(
$sheet_name,
$col_widths = [],
$auto_filter = false,
$freeze_rows = 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 coverSensitiveValues
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function coverSensitiveValues(array $data, array $keys = [])
{
if (empty($keys)) {
$keys = self::$sensitiveDefaultKeys;
}
- 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
Consider simplifying this complex logical expression. Open
if ($ignore_until == '' && ($c == ' ' || $c == '-' || $c == '(' || $c == ')') && ($i == 0 || $num_format[$i - 1] != '_')) {
$escaped .= "\\" . $c;
} else {
$escaped .= $c;
}
Function filterMatch
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function filterMatch($value, $conditions, $caseSensitive = true)
{
if (is_scalar($conditions)) {
$conditions = self::explode($conditions, ",", true, true);
}
- 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 folderToZip
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static function folderToZip($folder, &$zipFile, $exclusiveLength)
{
$handle = opendir($folder);
while (false !== $f = readdir($handle)) {
if ($f != '.' && $f != '..') {
- 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 writeToFile
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function writeToFile($filename)
{
foreach ($this->sheets as $sheet_name => $sheet) {
$this->finalizeSheet($sheet_name);//making sure all footers have been written
}
- 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 writeCell
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
XLSXWriter_BuffererWriter &$file,
$row_number,
$column_number,
$value,
$num_format_type,
Method markMergedCell
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function markMergedCell($sheet_name, $start_cell_row, $start_cell_column, $end_cell_row, $end_cell_column)
Method truncateMiddle
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function truncateMiddle($content, $word, $length, $affix = '..', $caseSensitive = false)
Method initializeSheet
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
$sheet_name,
$col_widths = [],
$auto_filter = false,
$freeze_rows = false,
$freeze_columns = false
Method template
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function template($template, array $variables = [], $removeEmpty = false, $leftDelimiter = '{{', $rightDelimiter = '}}')
Avoid too many return
statements within this method. Open
return 'n_datetime';
Avoid too many return
statements within this method. Open
return 'n_numeric';
Avoid too many return
statements within this method. Open
return 'n_date';