Function runProperties
has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring. Open
public function runProperties() {
if (ImportBootstrap::hasErrors()) {
return FALSE;
}
$properties = $this->db->query('SELECT `id`, `csv_name` FROM `shop_product_properties`')->result();
- Read upRead up
- Create a ticketCreate a ticket
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 BaseImport.php
has 387 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace import_export\classes;
use CI_DB_active_record;
- Create a ticketCreate a ticket
Function parseFile
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function parseFile($offers, $limit, $file = false) {
if (!$file) {
$file = @fopen($this->CSVsource, 'r');
}
if ($offers > 0) {
- Read upRead up
- Create a ticketCreate a ticket
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 runProperties
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function runProperties() {
if (ImportBootstrap::hasErrors()) {
return FALSE;
}
$properties = $this->db->query('SELECT `id`, `csv_name` FROM `shop_product_properties`')->result();
- Create a ticketCreate a ticket
Method content
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function content($node, $key) {
$parts = $this->parseCategoryName($node['cat']);
$pathIds = $pathNames = [];
$parentId = $line = 0;
- Create a ticketCreate a ticket
Function content
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private function content($node, $key) {
$parts = $this->parseCategoryName($node['cat']);
$pathIds = $pathNames = [];
$parentId = $line = 0;
- Read upRead up
- Create a ticketCreate a ticket
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 makeAttributesList
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function makeAttributesList() {
if (!count($this->possibleAttributes)) {
$this->possibleAttributes = [
'skip' => lang('Skip column', 'import_export'),
'name' => lang('Product Name', 'import_export'),
- Create a ticketCreate a ticket
Method parseFile
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function parseFile($offers, $limit, $file = false) {
if (!$file) {
$file = @fopen($this->CSVsource, 'r');
}
if ($offers > 0) {
- Create a ticketCreate a ticket
Function loadCategories
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function loadCategories() {
if (ImportBootstrap::hasErrors()) {
return FALSE;
}
$this->load->helper('translit');
- Read upRead up
- Create a ticketCreate a ticket
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 validateFile
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validateFile($offers, $limit) {
if (substr(sprintf('%o', fileperms(ImportBootstrap::getUploadDir())), -4) != '0777') {
ImportBootstrap::addMessage(Factor::ErrorFolderPermission);
return FALSE;
- Create a ticketCreate a ticket
Function validateFile
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function validateFile($offers, $limit) {
if (substr(sprintf('%o', fileperms(ImportBootstrap::getUploadDir())), -4) != '0777') {
ImportBootstrap::addMessage(Factor::ErrorFolderPermission);
return FALSE;
- Read upRead up
- Create a ticketCreate a ticket
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 FALSE;
- Create a ticketCreate a ticket