Showing 51 of 53 total issues
File XLSXWriter.php
has 1038 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace luya\yii\helpers;
use ZipArchive;
Function numberFormatStandardized
has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring. Open
private static function numberFormatStandardized($num_format)
{
if ($num_format == 'money') {
$num_format = 'dollar';
}
- 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 styleFontIndexes
has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring. Open
protected function styleFontIndexes()
{
static $border_allowed = ['left', 'right', 'top', 'bottom'];
static $border_style_allowed = [
'thin',
- 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
XLSXWriter
has 41 functions (exceeds 20 allowed). Consider refactoring. Open
class XLSXWriter
{
//https://www.ecma-international.org/publications/standards/Ecma-376.htm
//http://officeopenxml.com/SSstyles.php
//------------------------------------------------------------------
Function generateContentArray
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
protected static function generateContentArray($contentRows, array $keys, $generateHeader = true, $options = [])
{
if (is_scalar($contentRows)) {
throw new Exception("Content must be either an array, object or traversable.");
}
- 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 writeStylesXML
has 123 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function writeStylesXML()
{
$r = $this->styleFontIndexes();
$fills = $r['fills'];
$fonts = $r['fonts'];
Function writeStylesXML
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
protected function writeStylesXML()
{
$r = $this->styleFontIndexes();
$fills = $r['fills'];
$fonts = $r['fonts'];
- 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 styleFontIndexes
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function styleFontIndexes()
{
static $border_allowed = ['left', 'right', 'top', 'bottom'];
static $border_style_allowed = [
'thin',
Method initializeSheet
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function initializeSheet(
$sheet_name,
$col_widths = [],
$auto_filter = false,
$freeze_rows = false,
Function csvFromResource
has a Cognitive Complexity of 17 (exceeds 5 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.");
}
- 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 highlightWord
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public static function highlightWord($content, $word, $markup = '<b>%s</b>')
{
$transliterateContent = Inflector::transliterate($content);
$highlights = [];
- 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 convert_date_time
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function convert_date_time($date_input) //thanks to Excel::Writer::XLSX::Worksheet.pm (perl)
{
$days = 0; # Number of days since epoch
$seconds = 0; # Time expressed as fraction of 24h hours in seconds
$year = $month = $day = 0;
Method numberFormatStandardized
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function numberFormatStandardized($num_format)
{
if ($num_format == 'money') {
$num_format = 'dollar';
}
Function writeCell
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected function writeCell(
XLSXWriter_BuffererWriter &$file,
$row_number,
$column_number,
$value,
- 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 generateContentArray
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function generateContentArray($contentRows, array $keys, $generateHeader = true, $options = [])
{
if (is_scalar($contentRows)) {
throw new Exception("Content must be either an array, object or traversable.");
}
Function unlink
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public static function unlink($file)
{
// no errors should be thrown, return false instead.
try {
if (parent::unlink($file)) {
- 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 writeToFile
has 38 lines of code (exceeds 25 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
}
Method writeSheetRow
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function writeSheetRow($sheet_name, array $row, $row_options = null)
{
if (empty($sheet_name)) {
return;
}
Method highlightWord
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function highlightWord($content, $word, $markup = '<b>%s</b>')
{
$transliterateContent = Inflector::transliterate($content);
$highlights = [];
Function convert_date_time
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function convert_date_time($date_input) //thanks to Excel::Writer::XLSX::Worksheet.pm (perl)
{
$days = 0; # Number of days since epoch
$seconds = 0; # Time expressed as fraction of 24h hours in seconds
$year = $month = $day = 0;
- 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"