CORE-POS/IS4C

View on GitHub
pos/is4c-nf/lib/TransRecord.php

Summary

Maintainability
D
3 days
Test Coverage
A
94%

File TransRecord.php has 507 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*******************************************************************************

    Copyright 2001, 2004 Wedge Community Co-op

Severity: Major
Found in pos/is4c-nf/lib/TransRecord.php - About 1 day to fix

    Method addItem has 27 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    static private function addItem($strupc, $strdescription, $strtransType, $strtranssubType, $strtransstatus, $intdepartment, $dblquantity, $dblunitPrice, $dbltotal, $dblregPrice, $intscale, $inttax, $intfoodstamp, $dbldiscount, $dblmemDiscount, $intdiscountable, $intdiscounttype, $dblItemQtty, $intvolDiscType, $intvolume, $dblVolSpecial, $intmixMatch, $intmatched, $intvoided, $cost=0, $numflag=0, $charflag='') 
    Severity: Major
    Found in pos/is4c-nf/lib/TransRecord.php - About 3 hrs to fix

      Method addItem has 76 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      static private function addItem($strupc, $strdescription, $strtransType, $strtranssubType, $strtransstatus, $intdepartment, $dblquantity, $dblunitPrice, $dbltotal, $dblregPrice, $intscale, $inttax, $intfoodstamp, $dbldiscount, $dblmemDiscount, $intdiscountable, $intdiscounttype, $dblItemQtty, $intvolDiscType, $intvolume, $dblVolSpecial, $intmixMatch, $intmatched, $intvoided, $cost=0, $numflag=0, $charflag='') 
      {
          //$dbltotal = MiscLib::truncate2(str_replace(",", "", $dbltotal)); replaced by apbw 7/27/05 with the next 4 lines -- to fix thousands place errors
          $dbltotal = self::formatDouble($dbltotal);
          $dblunitPrice = self::formatDouble($dblunitPrice);
      Severity: Major
      Found in pos/is4c-nf/lib/TransRecord.php - About 3 hrs to fix

        TransRecord has 24 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class TransRecord 
        {
        
        /*------------------------------------------------------------------------------
        additem.php is the bread and butter of IT CORE. addItem inserts the information
        Severity: Minor
        Found in pos/is4c-nf/lib/TransRecord.php - About 2 hrs to fix

          Method addRecord has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          static public function addRecord($namedParams)
          {
              // start with default values
              $newRecord = self::$defaultRecord;
          
          
          Severity: Minor
          Found in pos/is4c-nf/lib/TransRecord.php - About 1 hr to fix

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

            static private function addItem($strupc, $strdescription, $strtransType, $strtranssubType, $strtransstatus, $intdepartment, $dblquantity, $dblunitPrice, $dbltotal, $dblregPrice, $intscale, $inttax, $intfoodstamp, $dbldiscount, $dblmemDiscount, $intdiscountable, $intdiscounttype, $dblItemQtty, $intvolDiscType, $intvolume, $dblVolSpecial, $intmixMatch, $intmatched, $intvoided, $cost=0, $numflag=0, $charflag='') 
            {
                //$dbltotal = MiscLib::truncate2(str_replace(",", "", $dbltotal)); replaced by apbw 7/27/05 with the next 4 lines -- to fix thousands place errors
                $dbltotal = self::formatDouble($dbltotal);
                $dblunitPrice = self::formatDouble($dblunitPrice);
            Severity: Minor
            Found in pos/is4c-nf/lib/TransRecord.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 addhousecoupon has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            static public function addhousecoupon($strupc, $intdepartment, $dbltotal, $description='', $discountable=1, $tax=0)
            Severity: Minor
            Found in pos/is4c-nf/lib/TransRecord.php - About 45 mins to fix

              Method addFlaggedTender has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              static public function addFlaggedTender($strtenderdesc, $strtendercode, $dbltendered, $numflag, $charflag) 
              Severity: Minor
              Found in pos/is4c-nf/lib/TransRecord.php - About 35 mins to fix

                Method addBogoDiscount has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                static public function addBogoDiscount($intdepartment, $dbltotal, $tax=0, $fs=0, $mixmatch='') 
                Severity: Minor
                Found in pos/is4c-nf/lib/TransRecord.php - About 35 mins to fix

                  Method addQueued has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  static public function addQueued($upc, $description, $numflag=0, $charflag='',$regPrice=0)
                  Severity: Minor
                  Found in pos/is4c-nf/lib/TransRecord.php - About 35 mins to fix

                    Function finalizeTransaction has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    static public function finalizeTransaction($incomplete=false)
                    {
                        if (!$incomplete) {
                            self::addtransDiscount();
                            self::addTax();
                    Severity: Minor
                    Found in pos/is4c-nf/lib/TransRecord.php - About 35 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

                    Function emptyQueue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    static public function emptyQueue()
                    {
                        $queue = CoreLocal::get("infoRecordQueue");    
                        if (!is_array($queue)) {
                            $queue = array();
                    Severity: Minor
                    Found in pos/is4c-nf/lib/TransRecord.php - About 25 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