Showing 4,217 of 4,217 total issues

Identical blocks of code found in 4 locations. Consider refactoring.
Open

    public function _get_methods_names_from_text($text = '', $ONLY_PRIVATE_METHODS = false)
    {
        $methods = [];
        if (empty($text)) {
            return $methods;
Severity: Major
Found in plugins/admin/admin_modules/yf_admin_modules.class.php and 3 other locations - About 2 hrs to fix
plugins/sys/classes/core_api/yf_core_api_admin_modules.class.php on lines 308..327
plugins/sys/classes/core_api/yf_core_api_user_modules.class.php on lines 286..306
plugins/user/admin_modules/yf_user_modules.class.php on lines 410..430

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 130.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

File yf_manage_emails.class.php has 268 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

class yf_manage_emails
{
    const table = 'emails_templates';
Severity: Minor
Found in plugins/email/admin_modules/yf_manage_emails.class.php - About 2 hrs to fix

    Function _operation has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public function _operation($options = null)
        {
            // import options
            is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
            // var
    Severity: Minor
    Found in plugins/payment/admin_modules/yf_manage_transfer.class.php - About 2 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

    Function _parse_sources has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public function _parse_sources($params = [])
        {
            $files = [];
            if ($params['include_framework']) {
                $params['find_php'] && $files['framework']['php'] = $this->_scan_files('framework', 'php', $params);

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

        public function _is_current_page($item)
        {
            $object = $_GET['object'];
            $action = $_GET['action'];
            $id = $_GET['id'];
    Severity: Minor
    Found in plugins/sys/classes/yf_core_menu.class.php - About 2 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

    Function _compile_prepare_cond has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public function _compile_prepare_cond($cond = '', $for_right = false)
        {
            $cond = trim($cond);
            $_array_magick = [
                '_key' => '$_k',
    Severity: Minor
    Found in plugins/tpl/classes/tpl/yf_tpl_driver_yf_compile.class.php - About 2 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

    Function display_what has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public function display_what()
        {
            $hooks_data = _class('admin_methods')->call_hooks('settings', $r);
            $avail_hook_modules = [];
            foreach ((array) $hooks_data as $k => $v) {
    Severity: Minor
    Found in plugins/conf/admin_modules/yf_settings.class.php - About 2 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

    Function validate has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public function validate($validate_rules = [], $post = [], $extra = [])
        {
            $this->_validate_prepare($validate_rules, $extra);
    
            $func = function ($validate_rules, $post, $extra, $form) {
    Severity: Minor
    Found in plugins/form2/classes/yf_form2.class.php - About 2 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

    Function whereid has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public function whereid()
        {
            $id = func_get_args();
            $pk = '';
            if (count((array) $id) > 1) {
    Severity: Minor
    Found in plugins/db/classes/db/yf_db_query_builder_driver.class.php - About 2 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

    Function load_data has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public function load_data()
        {
            // Preload db installer SQL CREATE TABLE DDL statements
            $ext = '.sql.php';
            $pattern = '{,plugins/*/}{,share/}db/sql/*' . $ext;
    Severity: Minor
    Found in plugins/db/classes/db/yf_db_installer.class.php - About 2 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

    Function list_keys has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public function list_keys()
        {
            $do_real_work = true;
            if ( ! $this->_driver_ok) {
                $do_real_work = false;
    Severity: Minor
    Found in plugins/cache/classes/yf_cache.class.php - About 2 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

    Function http_request has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public function http_request($url, $headers = [], $method = 'GET', $data = null, $retry = 3)
        {
            $result = new stdClass();
            // Parse the URL, and make sure we can handle the schema.
            $uri = parse_url($url);
    Severity: Minor
    Found in plugins/common/classes/common/yf_remote_files.class.php - About 2 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

    Function multi_file_size has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public function multi_file_size($page_urls, $options = [], $max_threads = 50)
        {
            if (empty($max_threads)) {
                $max_threads = $this->CURL_DEF_MAX_THREADS;
            }
    Severity: Minor
    Found in plugins/common/classes/common/yf_remote_files.class.php - About 2 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

    Function _hook_side_column has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public function _hook_side_column()
        {
            $custom_class_name = 'sample_' . $_GET['action'];
            $custom_obj = _class_safe($custom_class_name);
            $hook_name = __FUNCTION__;
    Severity: Minor
    Found in plugins/docs/modules/yf_docs.class.php - About 2 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

    Function send has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public function send($phone, $text, $params = [])
        {
            if ( ! $this->_is_enabled()) {
                return false;
            }
    Severity: Minor
    Found in plugins/sms/classes/yf_service_turbosms.class.php - About 2 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

    Function _check has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public function _check($target_user_id = 0, $source_user_id = 0)
        {
            if (empty($source_user_id) && ! empty(main()->USER_ID)) {
                $source_user_id = main()->USER_ID;
            }
    Severity: Minor
    Found in plugins/common/classes/common/yf_multi_accounts.class.php - About 2 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

    Function btn_active has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public function btn_active($name = '', $link = '', $extra = [])
        {
            if (is_array($name)) {
                $extra = $name;
                $name = '';
    Severity: Minor
    Found in plugins/table2/classes/yf_table2.class.php - About 2 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

    Function _lst has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public function _lst($id, $with_root = false)
        {
            $dir = $this->_path($id);
            $res = [];
            foreach (glob(rtrim($dir, '/') . '/*') as $f) {
    Severity: Minor
    Found in plugins/ckeditor/admin_modules/yf_ck_file_browser.class.php - About 2 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

    Function upload_images has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public function upload_images()
        {
            $SUPPLIER_ID = $this->SUPPLIER_ID;
            $ADMIN_INFO = db()->query_fetch('SELECT * FROM ' . db('sys_admin') . ' WHERE id=' . (int) (main()->ADMIN_ID));
            $SUPPLIER_INFO = db()->query_fetch('SELECT * FROM ' . db('shop_suppliers') . ' WHERE id=' . (int) $SUPPLIER_ID);

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

        public function _init_sftp_phpseclib($server_info = [])
        {
            if ( ! $this->DRIVER == 'phpseclib') {
                return false;
            }
    Severity: Minor
    Found in plugins/ssh/classes/yf_ssh.class.php - About 2 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

    Severity
    Category
    Status
    Source
    Language