piotrpolak/pepiscms

View on GitHub

Showing 481 of 486 total issues

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

    private function buildSubmenuUrl($module, $item, $language_code)
    {
        if (!$module->name) {
            $submenu_url = admin_url() . $item[self::PROP_CONTROLLER] . '/';
        } elseif (isset($item[self::PROP_MODULE]) && $item[self::PROP_MODULE]) {
Severity: Minor
Found in pepiscms/application/libraries/MenuRendor.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 getTranslatedValue has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    private function getTranslatedValue(array $definition, $fieldKey, $suffix = '')
    {

        $translatedValue = false;
        if ($this->lang !== null) {
Severity: Minor
Found in pepiscms/application/classes/CrudFieldDefinitionBuilder.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 ($normalize_keys) {
                                foreach ($keys as &$key) {
                                    $key = $this->normalizeKey($key);
                                }
                            }
Severity: Major
Found in pepiscms/application/libraries/Spreadsheet.php - About 45 mins to fix

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

        function module_icon_small_url($module_name = false)
        {
            $CI = get_instance();
            if (!$module_name) {
                if (isset($CI->modulerunner)) {
    Severity: Minor
    Found in pepiscms/application/helpers/PEPISCMS_url_helper.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 addField has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function addField($field, $label = false, $type = false, $default_value = false, $rules = false, $values = false)
    Severity: Minor
    Found in pepiscms/application/libraries/FormBuilder.php - About 45 mins to fix

      Method dashboard_box has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          function dashboard_box($name, $url, $icon_path = false, $description = false, $is_popup = false, $target = false)
      Severity: Minor
      Found in pepiscms/application/helpers/dialog_message_helper.php - About 45 mins to fix

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

            function module_icon_url($module_name = false)
            {
                $CI = get_instance();
                if (!$module_name) {
                    if (isset($CI->modulerunner)) {
        Severity: Minor
        Found in pepiscms/application/helpers/PEPISCMS_url_helper.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 renderInput has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            private function renderInput($field, $value, &$object,
                                         \PiotrPolak\PepisCMS\Formbuilder\Component\ComponentInterface $component, $readOnly)
            {
                $extra_css_classes = $this->computeExtraCssClasses($field);
        
        
        Severity: Minor
        Found in pepiscms/application/classes/DefaultFormRenderer.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 generateXML has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function generateXML($feed, $headers = false, $file_name = false, $send = true, $root_name = false, $item_name = false)
        Severity: Minor
        Found in pepiscms/application/libraries/Spreadsheet.php - About 45 mins to fix

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

              function google_maps_locate($address)
              {
                  $url = 'http://maps.google.com/maps/api/geocode/json?address=' . urlencode($address) . '&components=country:PL&sensor=false';
                  $contents = file_get_contents($url);
                  if (!$contents) {
          Severity: Minor
          Found in pepiscms/application/helpers/google_maps_helper.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 getCurrentLanguage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getCurrentLanguage()
              {
                  $CI = &get_instance();
                  $idiom = false;
          
          
          Severity: Minor
          Found in pepiscms/application/core/PEPISCMS_Lang.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 line has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function line($line = '', $default_value = null)
              {
                  // Changed parameter order - might be problematic
          
                  if ($line == '' || !isset($this->language[$line])) {
          Severity: Minor
          Found in pepiscms/application/core/PEPISCMS_Lang.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 delete has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function delete()
              {
                  $id = $this->input->getParam('id');
          
                  if (!$id || !$this->is_deletable) {
          Severity: Minor
          Found in pepiscms/modules/crud/libraries/AdminCRUDController.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 buildTranslations has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              private function buildTranslations($module_name, $translations, $module_label, $language_pairs, $directory, $module_name_lower_case)
          Severity: Minor
          Found in pepiscms/modules/development/libraries/ModuleGenerator.php - About 45 mins to fix

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

                public function getModuleTranslationKeys($module, $languages = false, $language_file = false)
                {
                    $language_file = $this->ensureLanguageFileIsSet($module, $language_file);
            
                    if (!$languages) {
            Severity: Minor
            Found in pepiscms/modules/translator/libraries/LanguageHelper.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 _datagrid_format_item_order_column has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function _datagrid_format_item_order_column($content, &$line)
                {
                    $id_field_name = &$this->id_field_name;
            
                    $o = $this->datagrid->getOrder();
            Severity: Minor
            Found in pepiscms/modules/crud/libraries/AdminCRUDController.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 moduleLibrary has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function moduleLibrary($module_name, $library, $params = null)
                {
                    if ($library == '') {
                        return false;
                    }
            Severity: Minor
            Found in pepiscms/application/core/PEPISCMS_Loader.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 formatCells has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            function formatCells($menu, $level, &$lang, &$url_suffix, $site_language, $view)
            Severity: Minor
            Found in pepiscms/modules/pages/views/admin/index.php - About 45 mins to fix

              Consider simplifying this complex logical expression.
              Open

                              if ($H >= 0 && $H <= 24
                                  && $i >= 0 && $i <= 60
                                  && $s >= 0 && $s <= 60
                              ) {
                                  return true;
              Severity: Major
              Found in pepiscms/application/libraries/PEPISCMS_Form_validation.php - About 40 mins to fix

                Consider simplifying this complex logical expression.
                Open

                <?php if ((SecurityManager::hasAccess('utilities', 'flush_html_cache') || SecurityManager::hasAccess('utilities', 'flush_security_policy_cache') || SecurityManager::hasAccess('utilities', 'flush_system_cache') || SecurityManager::hasAccess('acl') || SecurityManager::hasAccess('logs') || SecurityManager::hasAccess('utilities', 'systeminfo'))): ?>
                
                        <h1 class="contrasted"><?= $lang->line('utilities_label_cache') ?></h1>
                        <ul class="dashboard_actions clear">
                
                
                Severity: Major
                Found in pepiscms/application/views/admin/utilities_index.php - About 40 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language