File Products.php
has 716 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace exchange\classes;
use CI;
- Create a ticketCreate a ticket
Function processProducts1
has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring. Open
protected function processProducts1() {
$propertiesDataUpdate = [];
$productPropDTDel = [];
- 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 processProducts1
has 132 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function processProducts1() {
$propertiesDataUpdate = [];
$productPropDTDel = [];
- Create a ticketCreate a ticket
Function pass1Helper_getPropertiesData
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
protected function pass1Helper_getPropertiesData(SimpleXMLElement $product, $categoryId) {
$brandIdentif = Properties::getInstance()->getBrandIdentif();
$brandId = '';
- 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
Function processProducts23_Insert23
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
protected function processProducts23_Insert23() {
// process 2 (adding product_id to tables data)
$products = &$this->insertCollector->getData('shop_products');
$productsI18n = &$this->insertCollector->getData('shop_products_i18n');
- 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
Function pass1Helper_getImagesData
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
protected function pass1Helper_getImagesData(SimpleXMLElement $product, $exId) {
$additionalImages = NULL;
$mainImage = NULL;
- 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
Products
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class Products extends ExchangeBase
{
/**
*
- Create a ticketCreate a ticket
Method processProducts23_Insert23
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function processProducts23_Insert23() {
// process 2 (adding product_id to tables data)
$products = &$this->insertCollector->getData('shop_products');
$productsI18n = &$this->insertCollector->getData('shop_products_i18n');
- Create a ticketCreate a ticket
Function insert1
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected function insert1() {
$this->insertProducts($this->insertCollector->getData('shop_products'));
$this->dataLoad->getNewData('products');
- 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 pass1Helper_getPropertiesData
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function pass1Helper_getPropertiesData(SimpleXMLElement $product, $categoryId) {
$brandIdentif = Properties::getInstance()->getBrandIdentif();
$brandId = '';
- Create a ticketCreate a ticket
Method pass1Helper_getProductData
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function pass1Helper_getProductData(SimpleXMLElement $product, $exId) {
$products = [
'external_id' => $exId,
'active' => (string) $product->Статус == 'Удален' ? 0 : 1,
- Create a ticketCreate a ticket
Function pass1Helper_getProductData
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected function pass1Helper_getProductData(SimpleXMLElement $product, $exId) {
$products = [
'external_id' => $exId,
'active' => (string) $product->Статус == 'Удален' ? 0 : 1,
- 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 pass1Helper_getImagesData
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function pass1Helper_getImagesData(SimpleXMLElement $product, $exId) {
$additionalImages = NULL;
$mainImage = NULL;
- Create a ticketCreate a ticket
Function getCompareData
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function getCompareData($type = NULL) {
foreach ($this->products as $product) {
// external ids of products
if (!empty($product['external_id']) & ($type == NULL || (int) $type == 1)) {
- 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 rebuildAdditionalParentsCats
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function rebuildAdditionalParentsCats() {
$ids = [];
foreach ($this->products as $products) {
- Create a ticketCreate a ticket
Function rebuildAdditionalParentsCats
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function rebuildAdditionalParentsCats() {
$ids = [];
foreach ($this->products as $products) {
- 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 insertProducts
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function insertProducts($data) {
if (FALSE == (count($data) > 0)) {
return;
}
- Create a ticketCreate a ticket
Method pass1Helper_getVariantData
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function pass1Helper_getVariantData(SimpleXMLElement $product, $isNew = true) {
$variant = [
'external_id' => (string) $product->Ид,
'number' => (string) $product->Артикул,
- Create a ticketCreate a ticket
Function rebuildProductProperties
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function rebuildProductProperties() {
$productTableProperties = $this->db->select('shop_product_properties_data.property_id, shop_product_property_value_i18n.value, shop_product_property_value_i18n.locale')
->from('shop_product_properties_data')
->join('shop_product_property_value', 'shop_product_properties_data.value_id = shop_product_property_value.id')
- 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 rebuildProductProperties
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function rebuildProductProperties() {
$productTableProperties = $this->db->select('shop_product_properties_data.property_id, shop_product_property_value_i18n.value, shop_product_property_value_i18n.locale')
->from('shop_product_properties_data')
->join('shop_product_property_value', 'shop_product_properties_data.value_id = shop_product_property_value.id')
- Create a ticketCreate a ticket
Method update
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function update() {
// update has only two "passes" - as we already got product_id
$this->updateFromCollector('shop_products', 'id');
$this->updateFromCollector('shop_product_categories', 'product_id');
- Create a ticketCreate a ticket
Function addProductsToUpperCategories
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function addProductsToUpperCategories() {
$products = $this->db->select('shop_products.id, shop_category.full_path_ids')
->join('shop_category', 'shop_category.id = shop_products.category_id')
->get('shop_products')
- 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"