imagecms/ImageCMS

View on GitHub

Showing 1,388 of 1,858 total issues

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

    public function findPk($key, ConnectionInterface $con = null)
    {
        if ($key === null) {
            return null;
        }
Severity: Minor
Found in application/modules/xbanners/models/Base/BannerImageQuery.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

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

    public function addBannersI18n(ChildBannersI18n $l)
    {
        if ($l && $locale = $l->getLocale()) {
            $this->setLocale($locale);
            $this->currentTranslations[$locale] = $l;
Severity: Minor
Found in application/modules/xbanners/models/Base/Banners.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

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

    public function getGiftCertificate($key = null, $totalPrice = null) {
        $cart = BaseCart::getInstance();
        $this->baseDiscount = BaseDiscount::create();
        if ($totalPrice === null) {
            $totalPrice = $cart->getTotalPrice();
Severity: Minor
Found in application/modules/mod_discount/discount_api.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

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

    public function updateOne() {

        $name = $this->input->post('name');
        $type = $this->input->post('type');
        $locale = $this->input->post('locale');
Severity: Minor
Found in application/modules/translator/admin.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

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

    private function getAllOrderDiscountRegister() {

        $allOrderArrReg = [];
        foreach ($this->discountType['all_order'] as $disc) {
            if (!$disc['is_gift']) {
Severity: Minor
Found in application/modules/mod_discount/classes/BaseDiscount.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

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

    public function ajaxChangeActive() {
        $id = $this->input->post('id');

        // checking if discount exists
        $res = CI::$APP->db->get_where('mod_shop_discounts', ['id' => $id])->row_array();
Severity: Minor
Found in application/modules/mod_discount/admin.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

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

    private function getAllOrderDiscountNotRegister() {
        $allOrderArrNotReg = [];
        foreach ($this->discountType['all_order'] as $disc) {
            if (!$disc['is_gift']) {
                if ($disc['begin_value'] <= $this->total_Price and ! $disc['for_autorized']) {
Severity: Minor
Found in application/modules/mod_discount/classes/BaseDiscount.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

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

    public function setInitial($data = []) {

        if (count($data)) {
            foreach ($data as $key => $val) {
                if (isset($this->$key) AND method_exists($this->$key, 'setInitial')) {
Severity: Minor
Found in application/modules/forms/forms.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

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

    public function _numberAdd($arg) {
        $ci = &get_instance();
        $prodId = $arg['productId'];

        $prodVar = $ci->db
Severity: Minor
Found in application/modules/mod_auto_number/mod_auto_number.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

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

    public function parseMain() {

        try {
            if (!is_dir(self::$MAIN_PATH)) {
                return [];
Severity: Minor
Found in application/modules/translator/classes/FilesParser.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

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

    public function index() {
        $this->init();
        $status = $this->uri->segment(7);
        $off_set = $this->uri->segment(8);

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

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

    private function applyResultDiscount() {
        BaseDiscount::prepareOption(['reBuild' => 1]);
        $this->baseDiscount = BaseDiscount::create();

        if (BaseDiscount::checkModuleInstall()) {
Severity: Minor
Found in application/modules/mod_discount/mod_discount.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

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

    public function renderModulesNames($lang) {

        $langs = $this->session->userdata('langs_modules');
        $langs = $langs[$lang];
        $langs = sort_names($langs);
Severity: Minor
Found in application/modules/translator/admin.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

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

    public function getData() {

        $data = [];
        foreach ($this->fields as $key => $val) {
            if (isset($this->$key) AND method_exists($this->$key, 'getData')) {
Severity: Minor
Found in application/modules/forms/forms.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

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

    public function savePoArray($module_template, $type, $lang) {

        $po_array = (array) json_decode($this->input->post('po_array'));
        $showMessage = (bool) $this->input->post('showMessage');

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

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

    public function setAttributes($data = []) {

        if (count($data) > 0 AND $data != FALSE) {
            foreach ($data as $key => $val) {
                if (isset($this->$key) AND method_exists($this->$key, 'setAttributes')) {
Severity: Minor
Found in application/modules/forms/forms.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

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

    public function query_from_file($sqlString) {

        $allowedTables = \CI::$APP->load
            ->module('template_manager')
            ->config
Severity: Minor
Found in application/modules/template_manager/classes/TemplateManager.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

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

    private function add($pathArray, $isDir, &$tree) {
        $firstElement = array_shift($pathArray);
        if (count($pathArray) > 0) {
            if (!isset($tree[$firstElement])) {
                $tree[$firstElement] = [];
Severity: Minor
Found in application/modules/template_manager/classes/TArchive.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

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

    public function get_main_lang($flag = null) {

        $lang = $this->db->get('languages')->result_array();
        $lan_array = [];
        foreach ($lang as $l) {
Severity: Minor
Found in application/modules/banners/banners.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

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

    private function prepareData(\SimpleXMLElement $level) {
        if (strstr($level->getName(), 'level_')) {
            $attributes = $level->attributes();
            $level_number = (int) str_replace('level_', '', $level->getName());
            if (isset($this->categories_levels[$level_number])) {

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

Severity
Category
Status
Source
Language