File admin.php
has 918 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
use CMSFactory\assetManager;
use core\src\CoreFactory;
- Create a ticketCreate a ticket
Function edit_item
has a Cognitive Complexity of 96 (exceeds 5 allowed). Consider refactoring. Open
public function edit_item($item_id) {
if (!$this->input->post()) {
$item = $this->db
->where('menus_data.id', $item_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
Function create_item
has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring. Open
public function create_item($id = null) {
if (!$this->input->post()) {
$parents = $this->db
->where('menu_id', $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 edit_item
has 178 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function edit_item($item_id) {
if (!$this->input->post()) {
$item = $this->db
->where('menus_data.id', $item_id)
- Create a ticketCreate a ticket
Method create_item
has 133 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create_item($id = null) {
if (!$this->input->post()) {
$parents = $this->db
->where('menu_id', $id)
- Create a ticketCreate a ticket
Function insert_menu_item
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
public function insert_menu_item() {
$roles = $this->input->post('roles');
if ($roles == NULL) {
$roles = '';
- 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
Admin
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
class Admin extends BaseAdminController
{
/**
*
- Create a ticketCreate a ticket
Method insert_menu_item
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function insert_menu_item() {
$roles = $this->input->post('roles');
if ($roles == NULL) {
$roles = '';
- Create a ticketCreate a ticket
Function search_pages
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function search_pages($cur_page = 0) {
$data['nav_count'] = [];
$data['links'] = 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 search_pages
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function search_pages($cur_page = 0) {
$data['nav_count'] = [];
$data['links'] = 0;
- Create a ticketCreate a ticket
Function delete_menu
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function delete_menu($name = null) {
if ($name == null) {
$name = $this->input->post('ids');
foreach ($name as $n) {
- 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 delete_item
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function delete_item($id = null) {
if ($this->input->post('ids')) {
$id = $this->input->post('ids');
foreach ($id as $i) {
- 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 get_pages
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function get_pages($cat_id = 0, $cur_page = 0, $referer = null) {
$data['nav_count'] = [];
$data['links'] = 0;
$per_page = 10;
- 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 display_selector
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function display_selector($id, $type = 'page') {
$this->template->assign('insert_id', $id);
$this->menu->prepare_menu_array($this->get_name_by_id($id));
- Create a ticketCreate a ticket
Method get_pages
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_pages($cat_id = 0, $cur_page = 0, $referer = null) {
$data['nav_count'] = [];
$data['links'] = 0;
$per_page = 10;
- Create a ticketCreate a ticket
Method delete_menu
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function delete_menu($name = null) {
if ($name == null) {
$name = $this->input->post('ids');
foreach ($name as $n) {
- Create a ticketCreate a ticket
Method create_menu
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create_menu() {
//cp_check_perm('menu_create');
if ($this->input->post('menu_name') == NULL) {
showMessage(lang('Name field sieve', 'menu'), '', 'r');
- Create a ticketCreate a ticket
Method delete_item
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function delete_item($id = null) {
if ($this->input->post('ids')) {
$id = $this->input->post('ids');
foreach ($id as $i) {
- Create a ticketCreate a ticket
Function create_menu
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function create_menu() {
//cp_check_perm('menu_create');
if ($this->input->post('menu_name') == NULL) {
showMessage(lang('Name field sieve', 'menu'), '', 'r');
- 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 display_selector
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function display_selector($id, $type = 'page') {
$this->template->assign('insert_id', $id);
$this->menu->prepare_menu_array($this->get_name_by_id($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
Function get_item
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function get_item() {
$item_id = (int) $this->input->post('item_id');
$this->db->where('id', $item_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
Similar blocks of code found in 7 locations. Consider refactoring. Open
if ($this->input->post('page_item_image')) {
$image = $this->input->post('page_item_image');
} elseif ($this->input->post('cat_item_image')) {
$image = $this->input->post('cat_item_image');
} elseif ($this->input->post('module_item_image')) {
- 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 7 locations. Consider refactoring. Open
if ($this->input->post('page_newpage')) {
$newpage = $this->input->post('page_newpage');
} elseif ($this->input->post('cat_newpage')) {
$newpage = $this->input->post('cat_newpage');
} elseif ($this->input->post('module_newpage')) {
- 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 7 locations. Consider refactoring. Open
if ($this->input->post('page_newpage')) {
$newpage = $this->input->post('page_newpage');
} elseif ($this->input->post('cat_newpage')) {
$newpage = $this->input->post('cat_newpage');
} elseif ($this->input->post('module_newpage')) {
- 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 7 locations. Consider refactoring. Open
if ($this->input->post('page_parent_id')) {
$parent_id = $this->input->post('page_parent_id');
} elseif ($this->input->post('cat_parent_id')) {
$parent_id = $this->input->post('cat_parent_id');
} elseif ($this->input->post('module_parent_id')) {
- 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 7 locations. Consider refactoring. Open
if ($this->input->post('page_hidden')) {
$hidden = $this->input->post('page_hidden');
} elseif ($this->input->post('cat_hidden')) {
$hidden = $this->input->post('cat_hidden');
} elseif ($this->input->post('module_hidden')) {
- 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 7 locations. Consider refactoring. Open
if ($this->input->post('page_item_type')) {
$item_type = $this->input->post('page_item_type');
} elseif ($this->input->post('cat_item_type')) {
$item_type = $this->input->post('cat_item_type');
} elseif ($this->input->post('module_item_type')) {
- 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 7 locations. Consider refactoring. Open
if ($this->input->post('page_hidden')) {
$hidden = $this->input->post('page_hidden');
} elseif ($this->input->post('cat_hidden')) {
$hidden = $this->input->post('cat_hidden');
} elseif ($this->input->post('module_hidden')) {
- 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