HaaseIT/HCSF

View on GitHub

Showing 151 of 151 total issues

Method setupSession has 29 lines of code (exceeds 25 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

    Method handleItemGroups has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function handleItemGroups()
        {
            if (filter_input(INPUT_GET, 'clearorphaneditemgroups') !== null) {
                $this->db->exec('DELETE FROM itemgroups_text WHERE itmgt_pid NOT IN (SELECT itmg_id FROM itemgroups_base)');
            }
    Severity: Minor
    Found in src/Controller/Admin/DBStatus.php - About 1 hr to fix

      Method preparePage has 29 lines of code (exceeds 25 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

        Method getItemSuggestions has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getItemSuggestions(
                Items $oItem,
                $aPossibleSuggestions,
                $sSetSuggestions,
                $sCurrentitem,
        Severity: Minor
        Found in src/Shop/Helper.php - About 1 hr to fix

          Method setupTwig has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function setupTwig()
              {
                  $this->serviceManager->setFactory('twig', function (ServiceManager $serviceManager) {
                      $loader = new \Twig_Loader_Filesystem([PATH_BASEDIR.'customization/views', HCSF_BASEDIR.'src/views/']);
          
          
          Severity: Minor
          Found in src/HCSF.php - About 1 hr to fix

            Method getPurifier has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getPurifier($purpose)
                {
                    $purifier_config = \HTMLPurifier_Config::createDefault();
                    $purifier_config->set('Core.Encoding', 'UTF-8');
                    $purifier_config->set('Cache.SerializerPath', PATH_PURIFIERCACHE);
            Severity: Minor
            Found in src/Helper.php - About 1 hr to fix

              Method getItem has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function getItem($sItemno = '')
                  {
                      if ($sItemno === '') {
                          $sItemno = filter_input(INPUT_GET, 'itemno', FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
                          if (empty($sItemno)) {
              Severity: Minor
              Found in src/Controller/Admin/Shop/Itemadmin.php - About 1 hr to fix

                Function init has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function init()
                    {
                        $this->serviceManager = new ServiceManager();
                
                        if (!CLI) {
                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

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

                    public function preparePage()
                    {
                        $this->P = new \HaaseIT\HCSF\CorePage($this->serviceManager, [], 'admin/base.twig');
                        $this->P->cb_pagetype = 'content';
                        $this->P->cb_subnav = 'admin';
                Severity: Minor
                Found in src/Controller/Admin/Pageadmin.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 getRoutingoverride has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function getRoutingoverride($aPath)
                    {
                        $aRoutingoverride = [];
                        // /xxxx/item/0010.html
                        $aTMP['parts_in_path'] = count($aPath);
                Severity: Minor
                Found in src/Router.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 requireAdminAuth has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function requireAdminAuth() {
                
                        $adminusers = $this->config->getSecret('admin_users');
                        if ($this->requireAdminAuthAdminHome && (empty($adminusers) || !count($adminusers))) {
                            return true;
                Severity: Minor
                Found in src/Controller/Base.php - About 1 hr to fix

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

                      public function preparePage()
                      {
                          $this->P = new \HaaseIT\HCSF\CorePage($this->serviceManager, [], 'admin/base.twig');
                          $this->P->cb_pagetype = 'content';
                          $this->P->cb_subnav = 'admin';
                  Severity: Minor
                  Found in src/Controller/Admin/Index.php - About 1 hr to fix

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

                                        $aItem = [
                                            'amount' => $iAmount,
                                            'price' => $this->serviceManager->get('oItem')->calcPrice($aData['item'][$sItemno]),
                                            'rg' => $aData['item'][$sItemno]['itm_rg'],
                                            'vat' => $aData['item'][$sItemno]['itm_vatid'],
                    Severity: Major
                    Found in src/Controller/Shop/Updatecart.php and 1 other location - About 1 hr to fix
                    src/Controller/Shop/Updatecart.php on lines 122..129

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

                    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

                                                        [
                                                            'amount' => $iAmount,
                                                            'price' => $this->serviceManager->get('oItem')->calcPrice($additionaldata['item'][$additionalitem]),
                                                            'rg' => $additionaldata['item'][$additionalitem]['itm_rg'],
                                                            'vat' => $additionaldata['item'][$additionalitem]['itm_vatid'],
                    Severity: Major
                    Found in src/Controller/Shop/Updatecart.php and 1 other location - About 1 hr to fix
                    src/Controller/Shop/Updatecart.php on lines 106..113

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

                    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 preparePage has 26 lines of code (exceeds 25 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/Shop/Sofortueberweisung.php - About 1 hr to fix

                      Method getShoppingcartData has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function getShoppingcartData()
                          {
                              $aCartinfo = [
                                  'numberofitems' => 0,
                                  'cartsums' => [],
                      Severity: Minor
                      Found in src/Shop/Helper.php - About 1 hr to fix

                        Method sendCheckoutMails has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function sendCheckoutMails($iInsertID, $sMailbody_us, $sMailbody_they)
                            {
                                $aFilesToSend = [];
                                if (
                                    !empty($this->config->getShop('email_orderconfirmation_attachment_cancellationform_'.$this->config->getLang()))
                        Severity: Minor
                        Found in src/Controller/Shop/Shoppingcart.php - About 1 hr to fix

                          Method prepareItemlistsearchform has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private function prepareItemlistsearchform()
                              {
                                  $aData = [
                                      'searchcats' => [
                                          'nummer|'.$this->hardcodedtextcats->get('itemadmin_search_itemno'),
                          Severity: Minor
                          Found in src/Controller/Admin/Shop/Itemadmin.php - About 1 hr to fix

                            Method buildShoppingCartTable has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function buildShoppingCartTable(array $aCart, $bReadonly = false, $sCustomergroup = '', $aErr = [], $iVATfull = '', $iVATreduced = '')
                                {
                                    if ($iVATfull === '' && $iVATreduced === '') {
                                        $iVATfull = $this->shop['vat']['full'];
                                        $iVATreduced = $this->shop['vat']['reduced'];
                            Severity: Minor
                            Found in src/Shop/Helper.php - About 1 hr to fix

                              Method handlePasswordReset has 26 lines of code (exceeds 25 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
                                Severity
                                Category
                                Status
                                Source
                                Language