Showing 3,246 of 4,217 total issues

Function _validate_prepare has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    public function _validate_prepare($validate_rules = [], $extra = [])
    {
        $form_global_validate = isset($this->_params['validate']) ? $this->_params['validate'] : (isset($this->_replace['validate']) ? $this->_replace['validate'] : []);
        foreach ((array) $form_global_validate as $name => $rules) {
            $this->_validate_rules[$name] = $rules;
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 send has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    public function send(array $params = [], &$error_message = '')
    {
        require_php_lib('phpmailer');

        $mail = new PHPMailer(true); // defaults to using php 'mail()'
Severity: Minor
Found in plugins/email/classes/mail/yf_mail_driver_phpmailer.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 _split_by_comma has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    public function _split_by_comma(array $items)
    {
        // Pre-split items by comma
        foreach ($items as $k => $v) {
            if (is_string($v)) {
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 btn has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    public function btn($name, $link, $extra = [])
    {
        if (is_array($link)) {
            $extra = $link;
            $link = '';
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 _load_oauth_providers has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    public function _load_oauth_providers()
    {
        $config = $this->_load_oauth_config();
        if (isset($this->_providers_loaded)) {
            return $this->_providers;
Severity: Minor
Found in plugins/oauth/classes/yf_oauth.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 diff_config has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    public function diff_config($options = [])
    {
        if ( ! $options || ! is_array($options)) {
            return  null;
        }
Severity: Minor
Found in plugins/redis/classes/yf_wrapper_redis.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 read_file has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    public function read_file($server_info = [], $remote_file = '', $local_file = '')
    {
        $local_file = trim($local_file);
        $remote_file = _class('ssh')->_prepare_path($remote_file);
        if ( ! _class('ssh')->_INIT_OK || ! $server_info || ! strlen($remote_file)) {
Severity: Minor
Found in plugins/ssh/classes/ssh/yf_ssh_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 get_paths has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

function get_paths()
{
    $paths = [
        'called_path' => rtrim(getcwd(), '/') . '/',
        'yf_path' => dirname(dirname(__DIR__)) . '/',
Severity: Minor
Found in .dev/console/yf.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 show_html has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    public function show_html($page = 'form', $vars = [], $errors = [])
    {
        if (php_sapi_name() == 'cli' || ! $_SERVER['PHP_SELF']) {
            return print '__CONSOLE_INSTALL__' . PHP_EOL;
        }
Severity: Minor
Found in .dev/install/install.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

Method _payout_EcommPay has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function _payout_EcommPay($title)
    {
        $payment_api = _class('payment_api');
        $provider_class = $payment_api->provider_class([
            'provider_name' => 'ecommpay',
Severity: Major
Found in plugins/payment/modules/yf_payment_test.class.php - About 2 hrs to fix

    Method repair has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function repair($sql, $db_error, $db)
        {
            $sql = trim($sql);
            // #1191 Can't find FULLTEXT index matching the column list
            if (in_array($db_error['code'], [1191]) && $this->RESTORE_FULLTEXT_INDEX) {
    Severity: Major
    Found in plugins/db/classes/db/yf_db_installer_mysql.class.php - About 2 hrs to fix

      Method product_image_search has 68 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function product_image_search()
          {
              $_GET['id'] = (int) ($_GET['id']);
              if ($_GET['id']) {
                  $product = module('manage_shop')->_product_get_info($_GET['id']);

        Method _compile_if_funcs has 67 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function _compile_if_funcs(array $m)
            {
                $cond = trim($m['cond']);
                $multiple_cond = 'AND';
                if (in_array($cond, ['if_or', 'elseif_or'])) {
        Severity: Major
        Found in plugins/tpl/classes/tpl/yf_tpl_driver_yf_compile.class.php - About 2 hrs to fix

          Method load_data has 67 lines of code (exceeds 25 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: Major
          Found in plugins/db/classes/db/yf_db_installer.class.php - About 2 hrs to fix

            Method _get_rss_feed_array has 67 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function _get_rss_feed_array($rss_url = '', $feed_ttl = 3600, $num_items = 15)
                {
                    require_php_lib('yf_domit');
            
                    // Prepare cache params
            Severity: Major
            Found in plugins/common/classes/common/yf_rss_data.class.php - About 2 hrs to fix

              Method edit has 67 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function edit()
                  {
                      if (is_post() && isset($_POST['mass_delete']) && $_POST['id']) {
                          $_GET['action'] = 'delete';
                          return $this->delete();
              Severity: Major
              Found in plugins/redis/admin_modules/yf_manage_redis.class.php - About 2 hrs to fix

                Method _order_view has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function _order_view()
                    {
                        if ($_POST['order_id']) {
                            $_GET['id'] = (int) ($_POST['order_id']);
                        } else {
                Severity: Major
                Found in plugins/shop/modules/shop/yf_shop_order_view.class.php - About 2 hrs to fix

                  Method _show_category_contents has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function _show_category_contents($params = [])
                      {
                          $ICONS_PATH = 'uploads/icons/';
                          $MEDIA_PATH = WEB_PATH;
                          $force_stpl_name = isset($params['force_stpl_name']) ? $params['force_stpl_name'] : false;
                  Severity: Major
                  Found in plugins/categories/admin_modules/yf_category_editor.class.php - About 2 hrs to fix

                    Method _skip_by_pattern has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function _skip_by_pattern($path = '', $_is_dir = false, $pattern_include = '', $pattern_exclude = '')
                        {
                            if ( ! $path) {
                                return false;
                            }
                    Severity: Major
                    Found in classes/yf_dir.class.php - About 2 hrs to fix

                      Method test_load_fixtures has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function test_load_fixtures()
                          {
                              if ($this->_need_skip_test(__FUNCTION__)) {
                                  return;
                              }
                      Severity: Major
                      Found in .dev/tests/functional/model/class_model_sakila_test.Test.php - About 2 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language