DerDu/SPHERE-Framework

View on GitHub
Application/Billing/Bookkeeping/Invoice/Service.php

Summary

Maintainability
F
6 days
Test Coverage

File Service.php has 716 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace SPHERE\Application\Billing\Bookkeeping\Invoice;

use MOC\V\Component\Document\Component\Bridge\Repository\PhpExcel;
Severity: Major
Found in Application/Billing/Bookkeeping/Invoice/Service.php - About 1 day to fix

    Method createInvoice has 155 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function createInvoice(TblBasket $tblBasket)
        {
            /** Shopping Content */
            $tblBasketVerificationList = Basket::useService()->getBasketVerificationAllByBasket($tblBasket);
            if(!$tblBasketVerificationList){
    Severity: Major
    Found in Application/Billing/Bookkeeping/Invoice/Service.php - About 6 hrs to fix

      Function createInvoiceDebtorListExcel has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
      Open

          public function createInvoiceDebtorListExcel(
              $Year,
              $Month,
              $BasketName
          ) {
      Severity: Minor
      Found in Application/Billing/Bookkeeping/Invoice/Service.php - About 5 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 getInvoiceByPersonCauserAndItemAndYearAndMonth has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getInvoiceByPersonCauserAndItemAndYearAndMonth(
              TblPerson $tblPerson,
              TblItem $tblItem,
              $Year,
              $Month
      Severity: Minor
      Found in Application/Billing/Bookkeeping/Invoice/Service.php - About 4 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 createInvoiceDebtorListExcel has 82 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function createInvoiceDebtorListExcel(
              $Year,
              $Month,
              $BasketName
          ) {
      Severity: Major
      Found in Application/Billing/Bookkeeping/Invoice/Service.php - About 3 hrs to fix

        Service has 26 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Service extends AbstractService
        {
        
            /**
             * @param bool $doSimulation
        Severity: Minor
        Found in Application/Billing/Bookkeeping/Invoice/Service.php - About 3 hrs to fix

          Method getInvoiceCauserList has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getInvoiceCauserList(
                  $Year,
                  $Month,
                  $BasketName,
                  $ItemName,
          Severity: Major
          Found in Application/Billing/Bookkeeping/Invoice/Service.php - About 2 hrs to fix

            Method getInvoiceDebtorList has 57 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getInvoiceDebtorList(
                    $Year,
                    $Month,
                    $BasketName,
                    $IsFrontend
            Severity: Major
            Found in Application/Billing/Bookkeeping/Invoice/Service.php - About 2 hrs to fix

              Method getInvoiceUpPaidList has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getInvoiceUpPaidList()
                  {
              
                      $TableContent = array();
                      if($tblInvoiceItemDebtorList = Invoice::useService()->getInvoiceItemDebtorByIsPaid()){
              Severity: Major
              Found in Application/Billing/Bookkeeping/Invoice/Service.php - About 2 hrs to fix

                Method createInvoiceUpPaidListExcel has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function createInvoiceUpPaidListExcel() {
                        $resultList = $this->getInvoiceUpPaidList();
                        if(!empty($resultList)){
                            $fileLocation = Storage::createFilePointer('xlsx');
                            /** @var PhpExcel $export */
                Severity: Minor
                Found in Application/Billing/Bookkeeping/Invoice/Service.php - About 1 hr to fix

                  Method createInvoiceCauserListExcel has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function createInvoiceCauserListExcel(
                          $Year,
                          $Month,
                          $BasketName,
                          $ItemName
                  Severity: Minor
                  Found in Application/Billing/Bookkeeping/Invoice/Service.php - About 1 hr to fix

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

                        public function createInvoice(TblBasket $tblBasket)
                        {
                            /** Shopping Content */
                            $tblBasketVerificationList = Basket::useService()->getBasketVerificationAllByBasket($tblBasket);
                            if(!$tblBasketVerificationList){
                    Severity: Minor
                    Found in Application/Billing/Bookkeeping/Invoice/Service.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

                    Avoid deeply nested control flow statements.
                    Open

                                                    if($tblInvoiceItem->getId() == $tblItem->getId()){
                                                        $isInvoice = true;
                                                    }
                    Severity: Major
                    Found in Application/Billing/Bookkeeping/Invoice/Service.php - About 45 mins to fix

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

                              $Year,
                              $Month,
                              $BasketName,
                              $ItemName,
                              $IsFrontend
                      Severity: Minor
                      Found in Application/Billing/Bookkeeping/Invoice/Service.php - About 35 mins to fix

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

                            public function getMonthList($From = null, $To = null)
                            {
                        
                                $MonthList[1] = 'Januar';
                                $MonthList[2] = 'Februar';
                        Severity: Minor
                        Found in Application/Billing/Bookkeeping/Invoice/Service.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

                        There are no issues that match your filters.

                        Category
                        Status