HaaseIT/HCSF

View on GitHub

Showing 151 of 151 total issues

Method getLogin has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function getLogin()
    {
        $bTryEmail = false;
        if ('cust_no' !== 'cust_email') {
            $bTryEmail = true;
Severity: Minor
Found in src/Controller/Customer/Login.php - About 1 hr to fix

    Method handleForgotPassword has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function handleForgotPassword($aErr) {
            if (!filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL)) {
                $aErr[] = 'emailinvalid';
            } else {
                $querybuilder = $this->dbal->createQueryBuilder();
    Severity: Minor
    Found in src/Controller/Customer/Forgotpassword.php - About 1 hr to fix

      Method calcPrice has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function calcPrice($aData)
          {
              $aPrice = [];
              if ($aData['itm_vatid'] !== 'reduced') {
                  $aData['itm_vatid'] = 'full';
      Severity: Minor
      Found in src/Shop/Items.php - About 1 hr to fix

        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

          Function prepareSuggestions has a Cognitive Complexity of 14 (exceeds 5 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

          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 handleAddPage has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function handleAddPage()
              {
                  $aErr = [];
                  if (filter_input(INPUT_POST, 'addpage') === 'do') {
                      $sPagekeytoadd = trim(filter_input(INPUT_POST, 'pagekey', FILTER_SANITIZE_SPECIAL_CHARS));
          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

          Method showMyOrders has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function showMyOrders($COList)
              {
                  $return = '';
                  $sql = 'SELECT * FROM orders WHERE o_custno = :custno ORDER BY o_ordertimestamp DESC';
          
          
          Severity: Minor
          Found in src/Controller/Shop/Myorders.php - About 1 hr to fix

            Method prepareItem has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function prepareItem($aItemdata)
                {
                    $aData = [
                        'form' => ['action' => Tools::makeLinkHRefWithAddedGetVars('/_admin/itemadmin.html', ['action' => 'showitem', 'itemno' => $aItemdata['base']['itm_no']]),],
                        'id' => $aItemdata['base']['itm_id'],
            Severity: Minor
            Found in src/Controller/Admin/Shop/Itemadmin.php - About 1 hr to fix

              Method mailWrapper has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function mailWrapper($to, $subject = '(No subject)', $message = '', $aImagesToEmbed = [], $aFilesToAttach = []) {
                      $mail = new \PHPMailer;
                      $mail->CharSet = 'UTF-8';
              
                      $mail->isMail();
              Severity: Minor
              Found in src/Helper.php - About 1 hr to fix

                Method loadNavigation has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function loadNavigation(ServiceManager $serviceManager)
                    {
                        if (is_file(PATH_BASEDIR.'config/navigation.yml')) {
                            $navstruct = Yaml::parse(file_get_contents(PATH_BASEDIR.'config/navigation.yml'));
                        } else {
                Severity: Minor
                Found in src/HelperConfig.php - About 1 hr to fix

                  Method seekItem has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function seekItem(\HaaseIT\HCSF\Page $P, array $aP, Items $oItem)
                      {
                          // Change pagetype to itemoverview, will be changed back to itemdetail once the item is found
                          // if it is not found, we will show the overview
                          $aP['pagetype'] = 'itemoverview';
                  Severity: Minor
                  Found in src/Shop/Helper.php - About 1 hr to fix

                    Function calcPrice has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function calcPrice($aData)
                        {
                            $aPrice = [];
                            if ($aData['itm_vatid'] !== 'reduced') {
                                $aData['itm_vatid'] = 'full';
                    Severity: Minor
                    Found in src/Shop/Items.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 requireAdminAuth has a Cognitive Complexity of 13 (exceeds 5 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

                    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 13 (exceeds 5 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

                    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 sortItems has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function sortItems($mItemIndex = '', $mItemno = '', $bEnableItemGroups = false)
                          {
                              if ($mItemno !== '') {
                                  if (\is_array($mItemno)) {
                                      $TMP = [];
                      Severity: Minor
                      Found in src/Shop/Items.php - About 1 hr to fix

                        Method preparePage has 38 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/Resetpassword.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 getItemlist has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private function getItemlist()
                                {
                                    $sSearchstring = filter_input(INPUT_GET, 'searchstring', FILTER_SANITIZE_SPECIAL_CHARS);
                                    $sSearchstring = str_replace('*', '%', $sSearchstring);
                            
                            
                            Severity: Minor
                            Found in src/Controller/Admin/Shop/Itemadmin.php - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language