HaaseIT/HCSF

View on GitHub
src/Shop/Items.php

Summary

Maintainability
D
1 day
Test Coverage

Function getItemPathTree has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public function getItemPathTree()
    {
        $itemindexpathtree = [];
        $aItemoverviewpages = [];
        $sql = "SELECT * FROM content_base WHERE cb_pagetype = 'itemoverview' OR cb_pagetype = 'itemoverviewgrpd'";
Severity: Minor
Found in src/Shop/Items.php - About 2 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

Function sortItems has a Cognitive Complexity of 19 (exceeds 5 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 2 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

Function queryItemWhereClause has a Cognitive Complexity of 16 (exceeds 5 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 2 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 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

    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

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

            public function getItemPathTree()
            {
                $itemindexpathtree = [];
                $aItemoverviewpages = [];
                $sql = "SELECT * FROM content_base WHERE cb_pagetype = 'itemoverview' OR cb_pagetype = 'itemoverviewgrpd'";
        Severity: Minor
        Found in src/Shop/Items.php - About 1 hr to fix

          Function queryItem has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function queryItem($mItemIndex = '', $mItemno = '', $sOrderby = '')
              {
                  $sql = 'SELECT '.DB_ITEMFIELDS.' FROM item_base';
                  $sql .= ' LEFT OUTER JOIN item_lang ON item_base.itm_id = item_lang.itml_pid AND itml_lang = :lang';
                  $sql .= $this->queryItemWhereClause($mItemIndex, $mItemno);
          Severity: Minor
          Found in src/Shop/Items.php - About 45 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