File pages.php
has 732 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
use CMSFactory\Events;
use core\models\Route;
- Create a ticketCreate a ticket
Function update
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
public function update($page_id) {
$pagesPagination = $this->session->userdata('pages_pag_url');
$pagesPagination = $pagesPagination ?: 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
Method update
has 124 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function update($page_id) {
$pagesPagination = $this->session->userdata('pages_pag_url');
$pagesPagination = $pagesPagination ?: null;
- Create a ticketCreate a ticket
Function edit
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
public function edit($page_id, $lang = 0) {
$this->cms_base->setLocaleId($lang);
if ($this->cms_admin->get_page($page_id) == FALSE) {
showMessage(lang('Page', 'admin') . $page_id . lang('Not found', 'admin'), false, '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
Method GetPagesByCategory
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function GetPagesByCategory($cat_id = 'all', $pagination = null) {
//////********** Pagination pages **********\\\\\\\
if ($pagination) {
$paginationSession = ['pages_pag_url' => $pagination];
- Create a ticketCreate a ticket
Method edit
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function edit($page_id, $lang = 0) {
$this->cms_base->setLocaleId($lang);
if ($this->cms_admin->get_page($page_id) == FALSE) {
showMessage(lang('Page', 'admin') . $page_id . lang('Not found', 'admin'), false, 'r');
- Create a ticketCreate a ticket
Method add
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function add() {
$this->form_validation->set_rules('page_title', lang('Title', 'admin'), 'trim|required|min_length[1]|max_length[500]');
$this->form_validation->set_rules('page_url', lang('URL', 'admin'), 'alpha_dash|least_one_symbol|max_length[255]');
$this->form_validation->set_rules('prev_text', lang('Preliminary contents', 'admin'), 'trim|required');
- Create a ticketCreate a ticket
Method move_pages
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function move_pages($action) {
$ids = $this->input->post('pages');
$ids_key = array_flip($this->input->post('pages'));
- Create a ticketCreate a ticket
Pages
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class Pages extends BaseAdminController
{
public $_Config = ['per_page' => 20];
- Create a ticketCreate a ticket
Function move_pages
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function move_pages($action) {
$ids = $this->input->post('pages');
$ids_key = array_flip($this->input->post('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 add
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function add() {
$this->form_validation->set_rules('page_title', lang('Title', 'admin'), 'trim|required|min_length[1]|max_length[500]');
$this->form_validation->set_rules('page_url', lang('URL', 'admin'), 'alpha_dash|least_one_symbol|max_length[255]');
$this->form_validation->set_rules('prev_text', lang('Preliminary contents', 'admin'), 'trim|required');
- 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 GetPagesByCategory
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function GetPagesByCategory($cat_id = 'all', $pagination = null) {
//////********** Pagination pages **********\\\\\\\
if ($pagination) {
$paginationSession = ['pages_pag_url' => $pagination];
- 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 ajax_create_keywords
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function ajax_create_keywords() {
$text = $this->input->post('keys');
if ($text == '') {
- 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 delete
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function delete($page_id, $show_messages = TRUE) {
//cp_check_perm('page_delete');
$settings = $this->cms_admin->get_settings();
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if ($page_roles[$i2]['role_id'] == $roles[$i]['id']) {
$roles[$i]['selected'] = 'selected="true"';
}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if ($page_roles[$i2]['role_id'] == '0') {
$this->template->assign('all_selected', 'selected="true"');
}
- Create a ticketCreate a ticket
Function _set_page_roles
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function _set_page_roles($page_id, $roles) {
if ($roles[0] != '') {
$page_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"