File sitemap.php
has 476 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
use CMSFactory\Events;
use core\models\Route;
use core\src\CoreFactory;
- Create a ticketCreate a ticket
Function not_blocked_url
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public function not_blocked_url($url) {
if (!in_array($url, $this->blocked_urls) && !in_array(substr($url, 0, -1), $this->blocked_urls)) {
foreach ($this->blocked_urls as $blocked_url) {
$url = str_replace(site_url(), '', $url);
- 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
Sitemap
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class Sitemap extends MY_Controller
{
/**
* Blocked urls array
- Create a ticketCreate a ticket
Function getPagesCategories
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private function getPagesCategories() {
// Add categories to sitemap urls.
$categories = $this->lib_category->unsorted();
- 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 getShopCategories
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private function getShopCategories() {
// Get Shop Categories
$shop_categories = $this->sitemap_model->get_shop_categories();
- 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 generate_xml
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function generate_xml(array $items = []) {
$data = '';
$site_maps = [];
- 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 getPagesCategories
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getPagesCategories() {
// Add categories to sitemap urls.
$categories = $this->lib_category->unsorted();
- Create a ticketCreate a ticket
Function sitemap_ul
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function sitemap_ul($items = [], $pages_without_category = []) {
$out = '<ul class="sitemap">';
foreach ($items as $item) {
- 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 getAllPages
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function getAllPages() {
// Get all pages
$pages = $this->sitemap_model->get_all_pages();
- 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 getShopProducts
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function getShopProducts() {
// Get Shop products
$shop_products = $this->sitemap_model->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"
Further reading
Method not_blocked_url
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function not_blocked_url($url) {
if (!in_array($url, $this->blocked_urls) && !in_array(substr($url, 0, -1), $this->blocked_urls)) {
foreach ($this->blocked_urls as $blocked_url) {
$url = str_replace(site_url(), '', $url);
- Create a ticketCreate a ticket
Method generate_xml
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function generate_xml(array $items = []) {
$data = '';
$site_maps = [];
- Create a ticketCreate a ticket
Method initialize
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function initialize() {
// Get sitemap values
$priorities = $this->sitemap_model->getPriorities();
$changfreq = $this->sitemap_model->getChangefreq();
- Create a ticketCreate a ticket
Method getAllPages
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getAllPages() {
// Get all pages
$pages = $this->sitemap_model->get_all_pages();
- Create a ticketCreate a ticket
Method getShopCategories
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getShopCategories() {
// Get Shop Categories
$shop_categories = $this->sitemap_model->get_shop_categories();
- Create a ticketCreate a ticket
Method ping_google
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function ping_google() {
// Checking is used server is local
$ci = &get_instance();
- Create a ticketCreate a ticket
Function build_xml_map
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function build_xml_map($regenerate = FALSE) {
$settings = $this->sitemap_model->load_settings();
// Generate new or use saved map
- 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 getShopBrands
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function getShopBrands() {
// Get Shop Brands
$shop_brands = $this->sitemap_model->get_shop_brands();
- 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 _create_map
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function _create_map() {
if ($this->robotsCheck()) {
$this->initialize();
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ($changfreq) {
$this->main_page_changefreq = $changfreq['main_page_changefreq'];
$this->categories_changefreq = $changfreq['categories_changefreq'];
$this->products_categories_changefreq = $changfreq['products_categories_changefreq'];
$this->products_sub_categories_changefreq = $changfreq['products_sub_categories_changefreq'];
- Read upRead up
- Create a ticketCreate a ticket
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 ($priorities) {
$this->main_page_priority = $priorities['main_page_priority'];
$this->cats_priority = $priorities['cats_priority'];
$this->pages_priority = $priorities['pages_priority'];
$this->sub_cats_priority = $priorities['sub_cats_priority'];
- Read upRead up
- Create a ticketCreate a ticket
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 ($this->not_blocked_url($localeSegment . Route::createRouteUrl($shopprod['url'], $shopprod['parent_url'], Route::TYPE_PRODUCT))) {
if ($shopprod['updated'] > 0) {
$date = date('Y-m-d', $shopprod['updated']);
} else {
- Read upRead up
- Create a ticketCreate a ticket
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 95.
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 ($this->not_blocked_url($localeSegment . 'shop/brand/' . $shopbr['url'])) {
// create date
if ($shopbr['updated'] > 0) {
$date = date('Y-m-d', $shopbr['updated']);
} else {
- Read upRead up
- Create a ticketCreate a ticket
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 95.
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