imagecms/ImageCMS

View on GitHub
application/modules/callbacks/admin.php

Summary

Maintainability
F
3 days
Test Coverage

File admin.php has 402 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

(defined('BASEPATH')) OR exit('No direct script access allowed');

use CMSFactory\assetManager;
Severity: Minor
Found in application/modules/callbacks/admin.php - About 5 hrs to fix

Method index has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function index() {
        /** Callbacks Pagination */
        if ($this->input->get('per_page')) {
            $callbacksSession = [
                                 'callback_url' => '?per_page=' . $this->input->get('per_page'),
Severity: Major
Found in application/modules/callbacks/admin.php - About 2 hrs to fix

Function update has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function update($callbackId = null) {
        $model = SCallbacksQuery::create()->setComment(__METHOD__)->findPk((int) $callbackId);

        $paginationBrand = $this->session->userdata('callback_url');
        $paginationBrand = $paginationBrand ?: null;
Severity: Minor
Found in application/modules/callbacks/admin.php - About 1 hr to fix

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 updateStatus has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function updateStatus($statusId = null, $locale = null) {
        $locale = $locale ?: self::defaultLocale();

        $model = SCallbackStatusesQuery::create()->setComment(__METHOD__)->findPk((int) $statusId);

Severity: Minor
Found in application/modules/callbacks/admin.php - About 1 hr to fix

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 createStatus has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function createStatus() {
        $model = new SCallbackStatuses();
        $locale = self::defaultLocale();

        if ($this->input->post()) {
Severity: Minor
Found in application/modules/callbacks/admin.php - About 1 hr to fix

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 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function update($callbackId = null) {
        $model = SCallbacksQuery::create()->setComment(__METHOD__)->findPk((int) $callbackId);

        $paginationBrand = $this->session->userdata('callback_url');
        $paginationBrand = $paginationBrand ?: null;
Severity: Minor
Found in application/modules/callbacks/admin.php - About 1 hr to fix

Function index has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function index() {
        /** Callbacks Pagination */
        if ($this->input->get('per_page')) {
            $callbacksSession = [
                                 'callback_url' => '?per_page=' . $this->input->get('per_page'),
Severity: Minor
Found in application/modules/callbacks/admin.php - About 1 hr to fix

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 updateTheme has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function updateTheme($themeId = null, $locale = null) {
        $locale = $locale ?: self::defaultLocale();

        $model = SCallbackThemesQuery::create()->setComment(__METHOD__)->findPk((int) $themeId);

Severity: Minor
Found in application/modules/callbacks/admin.php - About 1 hr to fix

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 updateStatus has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function updateStatus($statusId = null, $locale = null) {
        $locale = $locale ?: self::defaultLocale();

        $model = SCallbackStatusesQuery::create()->setComment(__METHOD__)->findPk((int) $statusId);

Severity: Minor
Found in application/modules/callbacks/admin.php - About 1 hr to fix

Function createTheme has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function createTheme() {
        $model = new SCallbackThemes;

        if ($this->input->post()) {
            $this->form_validation->set_rules($model->rules());
Severity: Minor
Found in application/modules/callbacks/admin.php - About 1 hr to fix

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 updateTheme has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function updateTheme($themeId = null, $locale = null) {
        $locale = $locale ?: self::defaultLocale();

        $model = SCallbackThemesQuery::create()->setComment(__METHOD__)->findPk((int) $themeId);

Severity: Minor
Found in application/modules/callbacks/admin.php - About 1 hr to fix

Method initPagination has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function initPagination($totalCallbacks) {
        $this->load->library('pagination');
        $config['base_url'] = site_url('/admin/components/run/callbacks/index?') . http_build_query($this->input->get());
        $config['container'] = 'shopAdminPage';
        $config['uri_segment'] = 6;
Severity: Minor
Found in application/modules/callbacks/admin.php - About 1 hr to fix

Method createStatus has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function createStatus() {
        $model = new SCallbackStatuses();
        $locale = self::defaultLocale();

        if ($this->input->post()) {
Severity: Minor
Found in application/modules/callbacks/admin.php - About 1 hr to fix

Method createTheme has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function createTheme() {
        $model = new SCallbackThemes;

        if ($this->input->post()) {
            $this->form_validation->set_rules($model->rules());
Severity: Minor
Found in application/modules/callbacks/admin.php - About 1 hr to fix

Function setDefaultStatus has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function setDefaultStatus() {
        if ($this->input->post('id') && is_numeric($this->input->post('id'))) {
            $model = SCallbackStatusesQuery::create()->setComment(__METHOD__)->findPk($this->input->post('id'));
            if ($model) {
                if ($model->getIsDefault() == FALSE) {
Severity: Minor
Found in application/modules/callbacks/admin.php - About 35 mins to fix

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

There are no issues that match your filters.

Category
Status