HaaseIT/HCSF

View on GitHub
src/Controller/Shop/Shoppingcart.php

Summary

Maintainability
D
2 days
Test Coverage

File Shoppingcart.php has 328 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/*
    HCSF - A multilingual CMS and Shopsystem
    Copyright (C) 2014  Marcus Haase - mail@marcus.haase.name
Severity: Minor
Found in src/Controller/Shop/Shoppingcart.php - About 3 hrs to fix

    Function getNotification has a Cognitive Complexity of 23 (exceeds 5 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 3 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 buildOrderMailBody has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function buildOrderMailBody($bCust = true, $iId)
        {
            $aM = [
                'customdata' => $this->helperShop->buildShoppingCartTable($_SESSION['cart'], true),
                'currency' => $this->config->getShop('waehrungssymbol'),
    Severity: Minor
    Found in src/Controller/Shop/Shoppingcart.php - About 1 hr to fix

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

          public function preparePage()
          {
              $this->P = new \HaaseIT\HCSF\CorePage($this->serviceManager);
              $this->P->cb_pagetype = 'contentnosubnav';
      
      
      Severity: Minor
      Found in src/Controller/Shop/Shoppingcart.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 getItemImage has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function getItemImage($aV)
          {
              // base64 encode img and prepare for db
              // image/png image/jpeg image/gif
              // data:{mimetype};base64,XXXX
      Severity: Minor
      Found in src/Controller/Shop/Shoppingcart.php - About 1 hr to fix

        Method prepareDataOrder has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function prepareDataOrder()
            {
                $cartpricesums = $_SESSION['cartpricesums'];
                return [
                    'o_custno' => filter_var(trim(Tools::getFormfield('custno')), FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW),
        Severity: Minor
        Found in src/Controller/Shop/Shoppingcart.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 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

              Function getItemImage has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function getItemImage($aV)
                  {
                      // base64 encode img and prepare for db
                      // image/png image/jpeg image/gif
                      // data:{mimetype};base64,XXXX
              Severity: Minor
              Found in src/Controller/Shop/Shoppingcart.php - About 55 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

              There are no issues that match your filters.

              Category
              Status