imagecms/ImageCMS

View on GitHub

Showing 1,388 of 1,858 total issues

Function install has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function install() {
        foreach ($this->demodata->children() as $demodataName => $node) {
            $handlerClass = 'Demodata' . ucfirst($demodataName);
            include_once __DIR__ . DIRECTORY_SEPARATOR . $handlerClass . EXT;

Severity: Minor
Found in application/modules/template_manager/installer/DemodataDirector.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

Function getRemoteTemplate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function getRemoteTemplate($templateId = NULL) {
        if ($templateId) {
            $template_content = file_get_contents(self::REMOTE_TEMPLATES_REPOSITORY . $templateId);
            if ($template_content) {

Severity: Minor
Found in application/modules/template_manager/admin.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

Avoid deeply nested control flow statements.
Open

                                    if ($lang) {
                                        $lang = mb_ereg_search_getregs(); //get first result
                                        do {
                                            $origin = mb_ereg_replace('!\s+!', ' ', $lang[1]);

Severity: Major
Found in application/modules/translator/classes/FilesParser.php - About 45 mins to fix

Function prepareData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    private function prepareData(\SimpleXMLElement $field) {
        $attributes = $field->attributes();

        $fieldTypeId = $this->fieldTypes[(string) $attributes->type];
        $this->fieldData = [
Severity: Minor
Found in application/modules/template_manager/installer/DemodataCustomfields.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

Function searchLang has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    private function searchLang($origin, $data, $entity_type, $entity_name, $language) {
        switch ($this->searchType) {
            case 'all':
                if ($this->searchString($origin) || $this->searchString($data['translation'])) {
                    $data['origin'] = $origin;
Severity: Minor
Found in application/modules/translator/classes/PoFileSearch.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

Function loadDefaultComponents has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function loadDefaultComponents(array $except = []) {
        if (count($this->defaultComponents) > 0) {
            return;
        }
        $componentsPath = __DIR__ . '/../components/';
Severity: Minor
Found in application/modules/template_manager/classes/TemplateManager.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

Function getComponents has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function getComponents($type = self::COMPONENTS_ALL) {
        $tm = TemplateManager::getInstance();

        $this->loadDataFromXml();
        foreach ($this->xmlData['components'] as $componentName) {
Severity: Minor
Found in application/modules/template_manager/classes/Template.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

Function makePoFileSettings has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    private function makePoFileSettings($data = []) {
        if (!empty($data)) {
            $data = $this->prepareSettingsArray($data);
            $settings = [
                         'msgid ""',
Severity: Minor
Found in application/modules/translator/classes/PoFileManager.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

Function changefreq has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function changefreq() {
        if ($this->input->post()) {
            /**
             * Prepare data to update changefreq
             */
Severity: Minor
Found in application/modules/sitemap/admin.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

Function updateParams has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function updateParams($params = []) {
        if (count($params) > 0) {
            foreach ($params as $key => $data) {
                $component = \CI::$APP->db->where('component', $this->name)->where('key', $key)->get('template_settings');

Severity: Minor
Found in application/modules/template_manager/classes/TComponent.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

Function findCyrillicKeys has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public static function findCyrillicKeys($module) {
        if ($module == 'main') {
            $langStrings = self::parseMain();
        } else {
            $langStrings = self::parseModule($module);
Severity: Minor
Found in application/modules/translator/classes/LangReplacer.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

Function autosearch has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function autosearch() {
        switch ($this->input->post('queryString')) {
            case 'product':
                $entity = SProductsQuery::create()->setComment(__METHOD__)->joinWithI18n($this->def_locale)->filterByActive(true)->withColumn('SProductsI18n.Name', 'Name')->select(['Id', 'Name'])->find()->toArray();
                break;
Severity: Minor
Found in application/modules/banners/admin.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

Function uploadByUrl has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    private function uploadByUrl($url, $content = '') {
        if (!$content) {
            $ext = pathinfo($url, PATHINFO_EXTENSION);
            if ($ext != 'zip') {
                throw new Exception(lang('Wrong file type', 'template_manager'));
Severity: Minor
Found in application/modules/template_manager/admin.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

Function settings has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function settings() {
        if ($this->input->post()) {
            /** Data to update */
            $data = $this->input->post('settings');

Severity: Minor
Found in application/modules/sitemap/admin.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

Function _get_sub_menus has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function _get_sub_menus($id) {
        $sub_menus = [];

        foreach ($this->sub_menu_array as $sub_menu) {
            if ($sub_menu['parent_id'] == $id) {
Severity: Minor
Found in application/modules/menu/menu.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

Function validateData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    private function validateData($data, $signatureKey) {

        $fields = [];
        foreach ($data as $name => $value) {
            if ($name !== 'WMI_SIGNATURE') { $fields[$name] = $value;

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

    public function __construct() {

        parent::__construct();

        $this->time = time();
Severity: Minor
Found in application/modules/exchange/exchange.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

Avoid deeply nested control flow statements.
Open

                                if ($n_title['title']) {
                                    $menus[$i]['title'] = $n_title['title'];
                                }
Severity: Major
Found in application/modules/menu/menu.php - About 45 mins to fix

Function display has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function display($url) {

        $route = $this->router->findRoute($url);

        if (!$route) {
Severity: Minor
Found in application/modules/core/src/FrontController.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
Severity
Category
Status
Source
Language