HaaseIT/HCSF

View on GitHub

Showing 151 of 151 total issues

Method prepareSuggestions has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function prepareSuggestions($sSetSuggestions, array $aPossibleSuggestions, Items $oItem)
    {
        // prepare defined suggestions
        $sSetSuggestions = trim($sSetSuggestions);
        $aDefinedSuggestions = [];
Severity: Minor
Found in src/Shop/Helper.php - About 1 hr to fix

    Method handleItems has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function handleItems()
        {
            if (filter_input(INPUT_GET, 'clearorphaneditems') !== null) {
                $this->db->exec('DELETE FROM item_lang WHERE itml_pid NOT IN (SELECT itm_id FROM item_base)');
            }
    Severity: Minor
    Found in src/Controller/Admin/DBStatus.php - About 1 hr to fix

      Function getUserData has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getUserData($sField = '', $aUserdata = false)
          {
              if (!$aUserdata) {
                  if (!isset($_SESSION['user']) || !is_array($_SESSION['user'])) {
                      return false;
      Severity: Minor
      Found in src/Customer/Helper.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 setupSession has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function setupSession()
          {
              if (
                  (
                      $this->config->getCore('enable_module_customer')
      Severity: Minor
      Found in src/HCSF.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 __construct has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function __construct(ServiceManager $serviceManager, $iParentID, $bReturnRaw = false, UserPage $basePage = null) {
              parent::__construct($serviceManager);
      
              $this->dbal = $this->serviceManager->get('dbal');
      
      
      Severity: Minor
      Found in src/UserPagePayload.php - About 1 hr to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                                $querybuilder
                                    ->update('customer')
                                    ->set('cust_no', ':cust_no')
                                    ->set('cust_email', ':cust_email')
                                    ->set('cust_corp', ':cust_corp')
        Severity: Major
        Found in src/Controller/Admin/Customer/Customeradmin.php and 1 other location - About 1 hr to fix
        src/Controller/Customer/Register.php on lines 60..73

        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 107.

        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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                                $querybuilder
                                    ->insert('customer')
                                    ->setValue('cust_email', ':cust_email')
                                    ->setValue('cust_corp', ':cust_corp')
                                    ->setValue('cust_name', ':cust_name')
        Severity: Major
        Found in src/Controller/Customer/Register.php and 1 other location - About 1 hr to fix
        src/Controller/Admin/Customer/Customeradmin.php on lines 166..179

        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 107.

        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

        Method fillSuggestions has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function fillSuggestions($suggestions)
            {
                $iNumberOfSuggestions = count($suggestions['default']);
                if ($iNumberOfSuggestions > $this->shop['itemdetail_suggestions']) { // if there are more suggestions than should be displayed, randomly pick as many as to be shown
                    $aKeysSuggestions = array_rand($suggestions['default'], $this->shop['itemdetail_suggestions']); // get the array keys that will stay
        Severity: Minor
        Found in src/Shop/Helper.php - About 1 hr to fix

          Method getNotification has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function getNotification()
              {
                  $return = '';
                  $getmsg = filter_input(INPUT_GET, 'msg');
                  $getcartkey = filter_input(INPUT_GET, 'cartkey', FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
          Severity: Minor
          Found in src/Controller/Shop/Shoppingcart.php - About 1 hr to fix

            Method updatePage has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function updatePage(UserPage $Ptoedit)
                {
                    $purifier = false;
                    if ($this->config->getCore('pagetext_enable_purifier')) {
                        $purifier = $this->helper->getPurifier('page');
            Severity: Minor
            Found in src/Controller/Admin/Pageadmin.php - About 1 hr to fix

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

                  public function preparePage()
                  {
                      $this->P = new \HaaseIT\HCSF\CorePage($this->serviceManager);
                      $this->P->cb_pagetype = 'content';
              
              
              Severity: Minor
              Found in src/Controller/Customer/Login.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 addDataWhere has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function addDataWhere($field, $needle, $newfield, $content)
                  {
                      foreach ($this->items as $key => $item) {
                          if ($needle !== false) {
                              if (!empty($item['itm_data']->$field) && $item['itm_data']->$field == $needle) {
              Severity: Minor
              Found in src/Controller/CLI/Itemdata.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 handlePasswordReset has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function handlePasswordReset($aErr, $iID) {
                      $postpwd = filter_input(INPUT_POST, 'pwd');
                      if (!empty($postpwd)) {
                          if (strlen($postpwd) < $this->config->getCustomer('minimum_length_password')) {
                              $aErr[] = 'pwlength';
              Severity: Minor
              Found in src/Controller/Customer/Resetpassword.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 __construct has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function __construct(ServiceManager $serviceManager, $sPagekey, $bReturnRaw = false)
                  {
                      //if (!$bReturnRaw) $this->container = $container;
                      $this->serviceManager = $serviceManager;
                      $this->status = 200;
              Severity: Minor
              Found in src/UserPage.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 getLanguage has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getLanguage()
                  {
                      $langavailable = $this->core['lang_available'];
                      if (
                          $this->core['lang_detection_method'] === 'domain'
              Severity: Minor
              Found in src/HelperConfig.php - About 1 hr to fix

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

                    public function queryItemWhereClause($mItemIndex = '', $mItemno = '')
                    {
                        $sql = ' WHERE ';
                        $getsearchtext = filter_input(INPUT_GET, 'searchtext', FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
                        if (!empty($mItemno)) {
                Severity: Minor
                Found in src/Shop/Items.php - About 1 hr to fix

                  Method handleItemPage has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function handleItemPage(ServiceManager $serviceManager, \HaaseIT\HCSF\Page $P, array $aP)
                      {
                          $mItemIndex = '';
                          if (isset($P->cb_pageconfig->itemindex)) {
                              $mItemIndex = $P->cb_pageconfig->itemindex;
                  Severity: Minor
                  Found in src/Shop/Helper.php - About 1 hr to fix

                    Method __construct has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function __construct(ServiceManager $serviceManager, $sPagekey, $bReturnRaw = false)
                        {
                            //if (!$bReturnRaw) $this->container = $container;
                            $this->serviceManager = $serviceManager;
                            $this->status = 200;
                    Severity: Minor
                    Found in src/UserPage.php - About 1 hr to fix

                      Method preparePage has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function preparePage()
                          {
                              $headers = [
                                  'Content-Disposition' => 'attachment; filename=hcsf_export.csv',
                                  'Content-type' => 'text/csv',
                      Severity: Minor
                      Found in src/Controller/Admin/Shop/ShopadminExportCSV.php - About 1 hr to fix

                        Method showPageselect has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function showPageselect() {
                                $aGroups = [];
                                $adminpagegroups = $this->config->getCore('admin_page_groups');
                                foreach ($adminpagegroups as $sValue) {
                                    $TMP = explode('|', $sValue);
                        Severity: Minor
                        Found in src/Controller/Admin/Pageadmin.php - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language