HaaseIT/HCSF

View on GitHub

Showing 138 of 151 total issues

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

                      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

                          Severity
                          Category
                          Status
                          Source
                          Language