imagecms/ImageCMS

View on GitHub
application/libraries/lib_seo.php

Summary

Maintainability
D
1 day
Test Coverage

Method explode_str_on_words has 119 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function explode_str_on_words($text) {

        $search = [
                   "'ё'",
                   "'<script[^>]*?>.*?</script>'si",
Severity: Major
Found in application/libraries/lib_seo.php - About 4 hrs to fix

File lib_seo.php has 328 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
Severity: Minor
Found in application/libraries/lib_seo.php - About 3 hrs to fix

Function renderGAForCart has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    public function renderGAForCart($model = null, $GAid = null) {

        /* Show Google Analytics code if some value inserted in admin panel */
        if ($GAid['google_analytics_id']) {
            if ($this->getCustomParams()) {
Severity: Minor
Found in application/libraries/lib_seo.php - About 3 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 renderGAForCart has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function renderGAForCart($model = null, $GAid = null) {

        /* Show Google Analytics code if some value inserted in admin panel */
        if ($GAid['google_analytics_id']) {
            if ($this->getCustomParams()) {
Severity: Minor
Found in application/libraries/lib_seo.php - About 1 hr to fix

Method renderYaMetrica has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function renderYaMetrica($YaMetricaId = null) {

        $YandexMetrik = '';
        if ($YaMetricaId['yandex_metric']) {
            $YandexMetrik = '<!-- Yandex.Metrika counter -->
Severity: Minor
Found in application/libraries/lib_seo.php - About 1 hr to fix

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

    public function count_words() {

        $tmp_arr = [];
        foreach ($this->origin_arr as $val) {
            if (strlen(utf8_decode($val)) >= $this->min_word_length) {
Severity: Minor
Found in application/libraries/lib_seo.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

Function renderGA has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function renderGA($GAid = null) {

        /* Show Google Analytics code if some value inserted in admin panel */
        if ($GAid['google_analytics_id']) {
            if ($this->getCustomParams()) {
Severity: Minor
Found in application/libraries/lib_seo.php - About 25 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