File Archive_Zip.php
has 1668 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/* vim: set ts=4 sw=4: */
// +----------------------------------------------------------------------+
// | PHP Version 4 |
// +----------------------------------------------------------------------+
Function _extractByRule
has a Cognitive Complexity of 80 (exceeds 5 allowed). Consider refactoring. Open
public function _extractByRule(&$p_file_list, &$p_params)
{
$v_result=1;
$p_path = $p_params['add_path'];
- 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 _deleteByRule
has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring. Open
public function _deleteByRule(&$p_result_list, &$p_params)
{
$v_result=1;
$v_list_detail = [];
- 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 _extractFile
has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring. Open
public function _extractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_params)
{
$v_result=1;
// ----- Read the file header
- 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 _addFile
has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring. Open
public function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_params)
{
$v_result=1;
if ('' == $p_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 _deleteByRule
has 161 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _deleteByRule(&$p_result_list, &$p_params)
{
$v_result=1;
$v_list_detail = [];
Archive_Zip
has 43 functions (exceeds 20 allowed). Consider refactoring. Open
class Archive_Zip
{
/**
* The filename of the zip archive.
*
Method _addFile
has 123 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_params)
{
$v_result=1;
if ('' == $p_filename) {
Function _addFileList
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
public function _addFileList($p_list, &$p_result_list,
$p_add_dir, $p_remove_dir, $p_remove_all_dir,
&$p_params)
{
$v_result=1;
- 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 _extractByRule
has 122 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _extractByRule(&$p_file_list, &$p_params)
{
$v_result=1;
$p_path = $p_params['add_path'];
Method _extractFile
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _extractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_params)
{
$v_result=1;
// ----- Read the file header
Method _merge
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _merge(&$p_archive_to_add)
{
$v_result=1;
// ----- Look if the archive_to_add exists
Method _add
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _add($p_list, &$p_result_list, &$p_params)
{
$v_result=1;
$v_list_detail = [];
Function _readEndCentralDir
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function _readEndCentralDir(&$p_central_dir)
{
$v_result=1;
// ----- Go to the end of the zip 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 _readEndCentralDir
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _readEndCentralDir(&$p_central_dir)
{
$v_result=1;
// ----- Go to the end of the zip file
Function _tool_PathInclusion
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function _tool_PathInclusion($p_dir, $p_path)
{
$v_result = 1;
// ----- Explode dir and path by directory separator
- 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 _add
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function _add($p_list, &$p_result_list, &$p_params)
{
$v_result=1;
$v_list_detail = [];
- 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 _addFileList
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _addFileList($p_list, &$p_result_list,
$p_add_dir, $p_remove_dir, $p_remove_all_dir,
&$p_params)
{
$v_result=1;
Method _readCentralFileHeader
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _readCentralFileHeader(&$p_header)
{
$v_result=1;
// ----- Read the 4 bytes signature
Function _check_parameters
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function _check_parameters(&$p_params, $p_default)
{
// ----- Check that param is an array
if (!is_array($p_params)) {
- 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 _readFileHeader
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _readFileHeader(&$p_header)
{
$v_result=1;
// ----- Read the 4 bytes signature
Method _tool_PathInclusion
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _tool_PathInclusion($p_dir, $p_path)
{
$v_result = 1;
// ----- Explode dir and path by directory separator
Function _merge
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function _merge(&$p_archive_to_add)
{
$v_result=1;
// ----- Look if the archive_to_add exists
- 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 _readCentralFileHeader
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function _readCentralFileHeader(&$p_header)
{
$v_result=1;
// ----- Read the 4 bytes signature
- 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 _tool_CopyBlock
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function _tool_CopyBlock($p_src, $p_dest, $p_size, $p_mode=0)
{
$v_result = 1;
if (0 == $p_mode) {
- 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 _tool_CopyBlock
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _tool_CopyBlock($p_src, $p_dest, $p_size, $p_mode=0)
{
$v_result = 1;
if (0 == $p_mode) {
Method add
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function add($p_filelist, $p_params=0)
{
$this->_errorReset();
// ----- Set default values
Method _check_parameters
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _check_parameters(&$p_params, $p_default)
{
// ----- Check that param is an array
if (!is_array($p_params)) {
Function _dirCheck
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function _dirCheck($p_dir, $p_is_dir=false)
{
$v_result = 1;
// ----- Remove the final '/'
- 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 create
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create($p_filelist, $p_params=0)
{
$this->_errorReset();
// ----- Set default values
Method extract
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function extract($p_params=0)
{
$this->_errorReset();
// ----- Check archive
Method delete
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function delete($p_params)
{
$this->_errorReset();
// ----- Check archive
Function _tool_PathReduction
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function _tool_PathReduction($p_dir)
{
$v_result = '';
// ----- Look for not empty path
- 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 _duplicate
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _duplicate($p_archive_filename)
{
$v_result=1;
// ----- Look if the $p_archive_filename exists
Consider simplifying this complex logical expression. Open
if ((isset($p_params[ARCHIVE_ZIP_PARAM_BY_NAME]))
&& (0 != $p_params[ARCHIVE_ZIP_PARAM_BY_NAME])) {
// ----- Look if the filename is in the list
for ($j=0;
Consider simplifying this complex logical expression. Open
if ((isset($p_params[ARCHIVE_ZIP_PARAM_BY_NAME]))
&& (0 != $p_params[ARCHIVE_ZIP_PARAM_BY_NAME])) {
// ----- Look if the filename is in the list
for ($j=0;
Method _addList
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function _addList($p_list, &$p_result_list,
$p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_params)
Method _addFile
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_params)
Avoid deeply nested control flow statements. Open
if ((strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j]))
&& (substr($v_header_list[$v_nb_extracted]['stored_filename'], 0, strlen($p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j])) == $p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j])) {
$v_found = true;
} elseif ((0x00000010 == ($v_header_list[$v_nb_extracted]['external'] & 0x00000010)) /* Indicates a folder */
&& ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j])) {
Method _addFileList
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function _addFileList($p_list, &$p_result_list,
$p_add_dir, $p_remove_dir, $p_remove_all_dir,
&$p_params)
Function _addList
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function _addList($p_list, &$p_result_list,
$p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_params)
{
$v_result=1;
- 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 _extractFile
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function _extractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_params)
Function _readFileHeader
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function _readFileHeader(&$p_header)
{
$v_result=1;
// ----- Read the 4 bytes signature
- 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 duplicate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function duplicate($p_archive)
{
$this->_errorReset();
// ----- Look if the $p_archive is a Archive_Zip object
- 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 errorName
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function errorName($p_with_code=false)
{
$v_const_list = get_defined_constants();
// ----- Extract error constants from all const.
- 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 _tool_TranslateWinPath
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function _tool_TranslateWinPath($p_path, $p_remove_disk_letter=true)
{
if (mb_stristr(php_uname(), 'windows')) {
// ----- Look for potential disk letter
if (($p_remove_disk_letter)
- 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 $v_result;
Avoid too many return
statements within this method. Open
return $v_result;
Avoid too many return
statements within this method. Open
return $v_result;
Avoid too many return
statements within this method. Open
return $v_result;
Avoid too many return
statements within this method. Open
return $v_result;
Avoid too many return
statements within this method. Open
return $v_result;
Avoid too many return
statements within this method. Open
return $v_result;
Avoid too many return
statements within this method. Open
return $v_result;
Avoid too many return
statements within this method. Open
return $v_list;
Avoid too many return
statements within this method. Open
return $v_result;
Avoid too many return
statements within this method. Open
return $v_result;
Avoid too many return
statements within this method. Open
return Archive_Zip::errorCode();
Avoid too many return
statements within this method. Open
return $v_result;
Avoid too many return
statements within this method. Open
return $v_result;
Avoid too many return
statements within this method. Open
return $v_result;
Avoid too many return
statements within this method. Open
return Archive_Zip::errorCode();
Avoid too many return
statements within this method. Open
return $v_result;
Avoid too many return
statements within this method. Open
return $v_result;
Avoid too many return
statements within this method. Open
return Archive_Zip::errorCode();
Avoid too many return
statements within this method. Open
return $v_result;
Avoid too many return
statements within this method. Open
return Archive_Zip::errorCode();
Avoid too many return
statements within this method. Open
return $v_result;
Avoid too many return
statements within this method. Open
return $v_result;
Avoid too many return
statements within this method. Open
return $v_result;
Avoid too many return
statements within this method. Open
return $v_result;
Avoid too many return
statements within this method. Open
return $v_result;
Avoid too many return
statements within this method. Open
return $v_result;
Avoid too many return
statements within this method. Open
return Archive_Zip::errorCode();
Avoid too many return
statements within this method. Open
return $v_result;
Avoid too many return
statements within this method. Open
return $v_result;
Function add
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function add($p_filelist, $p_params=0)
{
$this->_errorReset();
// ----- Set default values
- 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 properties
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function properties()
{
$this->_errorReset();
// ----- Check archive
- 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 _list
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function _list(&$p_list)
{
$v_result=1;
// ----- Open the zip 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
Function create
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function create($p_filelist, $p_params=0)
{
$this->_errorReset();
// ----- Set default values
- 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 _extractFileAsString
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function _extractFileAsString(&$p_entry, &$p_string)
{
$v_result=1;
// ----- Read the file header
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
elseif ((isset($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX]))
&& (0 != $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX])) {
// ----- Look if the index is in the list
for ($j=$j_start; ($j < count($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX])) && (!$v_extract); $j++) {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 183.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
elseif ((isset($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX]))
&& (0 != $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX])) {
// ----- Look if the index is in the list
for ($j=$j_start;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 183.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
if ($p_header['mdate'] && $p_header['mtime']) {
// ----- Extract time
$v_hour = ($p_header['mtime'] & 0xF800) >> 11;
$v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
$v_seconde = ($p_header['mtime'] & 0x001F)*2;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 182.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
if ($p_header['mdate'] && $p_header['mtime']) {
// ----- Extract time
$v_hour = ($p_header['mtime'] & 0xF800) >> 11;
$v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
$v_seconde = ($p_header['mtime'] & 0x001F)*2;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 182.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (is_array($p_filelist)) {
$v_result = $this->_create($p_filelist, $p_result_list, $p_params);
}
// ----- Look if the $p_filelist is a string
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 109.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (is_array($p_filelist)) {
// ----- Call the create fct
$v_result = $this->_add($p_filelist, $p_result_list, $p_params);
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 109.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76