Showing 3,246 of 4,217 total issues

Function data_get_latest_countries has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    function data_get_latest_countries()
    {
        global $url, $result_file, $suffix, $mtpl;

        $f2 = __DIR__ . '/' . basename($url) . '.table' . $suffix . '.html';
Severity: Minor
Found in .dev/scripts/countries/get_latest_countries.php - About 1 hr 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_db_class has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    function load_db_class()
    {
        static $_loaded_class;
        if ($_loaded_class) {
            return $_loaded_class;
Severity: Minor
Found in functions/yf_common_funcs.php - About 1 hr 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 add has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function add()
    {
        $a = (array) $_POST + (array) $a;
        $a['back_link'] = url('/@object');
        $a['locale'] = $a['locale'] ?: conf('language');
Severity: Minor
Found in plugins/static_pages/admin_modules/yf_static_pages.class.php - About 1 hr to fix

    Method get_asset_from_github has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function get_asset_from_github($name, $version = 'master', $asset_data = [], $asset_type)
        {
            if ( ! $name || ! $asset_data || ! isset($asset_data[$asset_type])) {
                return false;
            }
    Severity: Minor
    Found in plugins/assets/classes/yf_assets.class.php - About 1 hr to fix

      Method init_locale has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function init_locale()
          {
              $langs = $this->LANGUAGES ?: $this->_get_langs();
              $lang = strtolower($this->_get_current_lang());
              $charset = strtolower($this->_get_current_charset());
      Severity: Minor
      Found in plugins/locale/classes/yf_i18n.class.php - About 1 hr to fix

        Method _get_vars_from_files has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function _get_vars_from_files($lang)
            {
                $files = [];
                // Auto-find shared language vars. They will be connected in order of file system
                // Names can be any, but better to include lang name into file name. Examples:
        Severity: Minor
        Found in plugins/locale/admin_modules/yf_locale_editor.class.php - About 1 hr to fix

          Method _get_combined_version has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function _get_combined_version($out_type = '')
              {
                  if ( ! is_string($this->COMBINED_VERSION_TPL) && is_callable($this->COMBINED_VERSION_TPL)) {
                      $func = $this->COMBINED_VERSION_TPL;
                      $version = $func($out_type, $this);
          Severity: Minor
          Found in plugins/assets/classes/yf_assets.class.php - About 1 hr to fix

            Method _parse_sources has 31 lines of code (exceeds 25 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);

              Method _url_get_contents has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function _url_get_contents($url)
                  {
                      if ( ! strlen($url)) {
                          return false;
                      }
              Severity: Minor
              Found in plugins/assets/classes/yf_assets.class.php - About 1 hr to fix

                Method payin has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function payin()
                    {
                        if ( ! empty($_POST)) {
                            $payment_api = _class('payment_api');
                            $dump = $payment_api->dump();
                Severity: Minor
                Found in plugins/payment/modules/yf_payment_test.class.php - About 1 hr to fix

                  Method _http_csv has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function _http_csv($options = null)
                      {
                          // import options
                          is_array($options) && extract($options, EXTR_PREFIX_ALL | EXTR_REFS, '');
                          if ( ! is_array($_data) || empty($_file_name)) {
                  Severity: Minor
                  Found in plugins/payment/admin_modules/yf_manage_payout.class.php - About 1 hr to fix

                    Method _operation has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function _operation($request, $options)
                        {
                            $api = _class('api');
                            $payment_api = _class('payment_api');
                            // update account, operation
                    Severity: Minor
                    Found in plugins/payment/modules/yf_payment.class.php - About 1 hr to fix

                      Method _form has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function _form($data, $options = null)
                          {
                              if ( ! $this->ENABLE) {
                                  return  null;
                              }

                        Method recreate_items has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function recreate_items()
                            {
                                // options
                                $operation_id = @$_GET['operation_id'];
                                $items = explode(',', @$_GET['items']);
                        Severity: Minor
                        Found in plugins/payment/admin_modules/yf_manage_payout.class.php - About 1 hr to fix

                          Method _form has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function _form($data, $options = null)
                              {
                                  if ( ! $this->ENABLE) {
                                      return  null;
                                  }

                            Method copy_item has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function copy_item()
                                {
                                    $dir_name = urldecode($_POST['dir_name']);
                                    $items_to_copy = [];
                                    foreach ((array) $_POST as $k => $v) {
                            Severity: Minor
                            Found in plugins/sys/admin_modules/yf_file_manager.class.php - About 1 hr to fix

                              Method parse has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function parse($name, $replace = [], $params = [])
                                  {
                                      $string = $params['string'] ?: false;
                              
                                      $this->_fix_replace($replace, $name);
                              Severity: Minor
                              Found in plugins/tpl/classes/tpl/yf_tpl_driver_yf.class.php - About 1 hr to fix

                                Method _do_logout has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function _do_logout($no_redirect = false)
                                    {
                                        if ($this->STORE_ONLINE_USERS) {
                                            db()->_add_shutdown_query('DELETE FROM ' . db('online') . ' WHERE user_id=' . (int) ($_SESSION[$this->VAR_USER_ID]));
                                            $MAIN = &main();
                                Severity: Minor
                                Found in plugins/auth/classes/auth/yf_auth_user.class.php - About 1 hr to fix

                                  Method _get_info has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function _get_info($id = null, $lang = null)
                                      {
                                          $id = isset($id) ? $id : $_GET['id'];
                                          $lang = isset($lang) ? $lang : $_GET['page'];
                                          $a = db()->from(self::table)
                                  Severity: Minor
                                  Found in plugins/email/admin_modules/yf_manage_emails.class.php - About 1 hr to fix

                                    Method _init has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        public function _init()
                                        {
                                            $this->REWRITE_PATTERNS = [
                                                'yf' => _class('rewrite_pattern_yf', 'classes/rewrite/'),
                                            ];
                                    Severity: Minor
                                    Found in plugins/rewrite/classes/yf_rewrite.class.php - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language