imagecms/ImageCMS

View on GitHub
application/modules/core/core.php

Summary

Maintainability
C
1 day
Test Coverage

Function set_meta_tags has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    public function set_meta_tags($title = '', $keywords = '', $description = '', $page_number = '', $showsitename = 0, $category = '') {

        if ($this->core_data['data_type'] == 'main') {
            $this->template->add_array(
                [
Severity: Minor
Found in application/modules/core/core.php - About 5 hrs 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 set_meta_tags has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function set_meta_tags($title = '', $keywords = '', $description = '', $page_number = '', $showsitename = 0, $category = '') {

        if ($this->core_data['data_type'] == 'main') {
            $this->template->add_array(
                [
Severity: Major
Found in application/modules/core/core.php - About 2 hrs to fix

Method robots has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function robots() {

        $robotsSettings = $this->db->select('robots_settings,robots_settings_status,robots_status')->get('settings');
        if ($robotsSettings) {
            $robotsSettings = $robotsSettings->row();
Severity: Minor
Found in application/modules/core/core.php - About 1 hr to fix

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

    public static function adminAutoload() {
        $subscriber = new RouteSubscriber();

        foreach ($subscriber->getHandlers() as $eventName => $callback) {

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

Function robots has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function robots() {

        $robotsSettings = $this->db->select('robots_settings,robots_settings_status,robots_status')->get('settings');
        if ($robotsSettings) {
            $robotsSettings = $robotsSettings->row();
Severity: Minor
Found in application/modules/core/core.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 grab_variables has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function grab_variables($n) {

        $args = [];

        foreach ($this->uri->uri_to_assoc($n) as $k => $v) {
Severity: Minor
Found in application/modules/core/core.php - About 45 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

Method set_meta_tags has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function set_meta_tags($title = '', $keywords = '', $description = '', $page_number = '', $showsitename = 0, $category = '') {
Severity: Minor
Found in application/modules/core/core.php - About 45 mins to fix

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

    public function setLastModified($LastModified_unix) {

        if ($LastModified_unix < time() - 60 * 60 * 24 * 4 or $LastModified_unix > time()) {
            if (in_array(date('D', time()), ['Mon', 'Tue', 'Wen'])) {
                $LastModified_unix = strtotime('last sunday', time());
Severity: Minor
Found in application/modules/core/core.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