DerDu/SPHERE-Framework

View on GitHub
Application/Api/Billing/Bookkeeping/ApiBasket.php

Summary

Maintainability
F
1 wk
Test Coverage

Function saveAddBasket has a Cognitive Complexity of 83 (exceeds 5 allowed). Consider refactoring.
Open

    public function saveAddBasket($Identifier = '', $Basket = array())
    {

        // Handle error's
        if($form = $this->checkInputBasket($Identifier, '', $Basket)){
Severity: Minor
Found in Application/Api/Billing/Bookkeeping/ApiBasket.php - About 1 day 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

File ApiBasket.php has 651 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace SPHERE\Application\Api\Billing\Bookkeeping;

use SPHERE\Application\Api\ApiTrait;
Severity: Major
Found in Application/Api/Billing/Bookkeeping/ApiBasket.php - About 1 day to fix

    Function formBasket has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
    Open

        public function formBasket($Identifier = '', $BasketId = '')
        {
    
            // SelectBox content
            $YearList = Invoice::useService()->getYearList(1, 1);
    Severity: Minor
    Found in Application/Api/Billing/Bookkeeping/ApiBasket.php - About 6 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 checkInputBasket has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

        private function checkInputBasket(
            $Identifier = '',
            $BasketId = '',
            $Basket = array()
        ){
    Severity: Minor
    Found in Application/Api/Billing/Bookkeeping/ApiBasket.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

    Method saveAddBasket has 128 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function saveAddBasket($Identifier = '', $Basket = array())
        {
    
            // Handle error's
            if($form = $this->checkInputBasket($Identifier, '', $Basket)){
    Severity: Major
    Found in Application/Api/Billing/Bookkeeping/ApiBasket.php - About 5 hrs to fix

      Method formBasket has 112 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function formBasket($Identifier = '', $BasketId = '')
          {
      
              // SelectBox content
              $YearList = Invoice::useService()->getYearList(1, 1);
      Severity: Major
      Found in Application/Api/Billing/Bookkeeping/ApiBasket.php - About 4 hrs to fix

        Method checkInputBasket has 66 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function checkInputBasket(
                $Identifier = '',
                $BasketId = '',
                $Basket = array()
            ){
        Severity: Major
        Found in Application/Api/Billing/Bookkeeping/ApiBasket.php - About 2 hrs to fix

          ApiBasket has 23 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class ApiBasket extends Extension implements IApiInterface
          {
          
              // registered method
              use ApiTrait;
          Severity: Minor
          Found in Application/Api/Billing/Bookkeeping/ApiBasket.php - About 2 hrs to fix

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

                public function showDeleteBasket($Identifier = '', $BasketId = '')
                {
            
                    $tblBasket = Basket::useService()->getBasketById($BasketId);
                    if($tblBasket){
            Severity: Minor
            Found in Application/Api/Billing/Bookkeeping/ApiBasket.php - About 1 hr to fix

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

                  public function showDeleteBasket($Identifier = '', $BasketId = '')
                  {
              
                      $tblBasket = Basket::useService()->getBasketById($BasketId);
                      if($tblBasket){
              Severity: Minor
              Found in Application/Api/Billing/Bookkeeping/ApiBasket.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

              Avoid too many return statements within this method.
              Open

                              return new Success('Abrechnung erfolgreich angelegt').
                                  new Warning('Folgende Zahlungszuweisungen wurden herrausgefiltert:<br/>'
                                  .implode('<br/>', $PersonMissing))
                                  .ApiBasket::pipelineRefreshTable();
              Severity: Major
              Found in Application/Api/Billing/Bookkeeping/ApiBasket.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return new Danger('Abrechnung konnte nicht gengelegt werden');
                Severity: Major
                Found in Application/Api/Billing/Bookkeeping/ApiBasket.php - About 30 mins to fix

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      public static function pipelineOpenEditBasketModal(
                          $Identifier = '',
                          $BasketId = '',
                          $Basket = array()
                      ){
                  Severity: Major
                  Found in Application/Api/Billing/Bookkeeping/ApiBasket.php and 1 other location - About 2 hrs to fix
                  Application/Api/Billing/Accounting/ApiCreditor.php on lines 140..157

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 136.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      public static function pipelineOpenAddBasketModal($Identifier = '', $Basket = array(), $ErrorHelp = array())
                      {
                  
                          $Receiver = self::receiverModal(null, $Identifier);
                          $Pipeline = new Pipeline();
                  Severity: Major
                  Found in Application/Api/Billing/Bookkeeping/ApiBasket.php and 1 other location - About 2 hrs to fix
                  Application/Api/Billing/Inventory/ApiItem.php on lines 115..132

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 131.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                          if($form = $this->checkInputBasket($Identifier, $BasketId, $Basket)){
                              // display Errors on form
                              $Global = $this->getGlobal();
                              $Global->POST['Basket']['Name'] = $Basket['Name'];
                              $Global->POST['Basket']['Description'] = $Basket['Description'];
                  Severity: Major
                  Found in Application/Api/Billing/Bookkeeping/ApiBasket.php and 1 other location - About 2 hrs to fix
                  Application/Api/Billing/Inventory/ItemVariant.php on lines 331..341

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 125.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 4 locations. Consider refactoring.
                  Open

                      public static function pipelineSaveEditBasket($Identifier = '', $BasketId = '')
                      {
                  
                          $Receiver = self::receiverModal(null, $Identifier);
                          $Pipeline = new Pipeline(true);
                  Severity: Major
                  Found in Application/Api/Billing/Bookkeeping/ApiBasket.php and 3 other locations - About 2 hrs to fix
                  Application/Api/Billing/Accounting/ApiCreditor.php on lines 165..181
                  Application/Api/Billing/Bookkeeping/ApiBasketVerification.php on lines 449..465
                  Application/Api/Billing/Inventory/ApiItem.php on lines 190..206

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 124.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 14 locations. Consider refactoring.
                  Open

                      public static function pipelineOpenDeleteBasketModal($Identifier = '', $BasketId = '')
                      {
                  
                          $Receiver = self::receiverModal(null, $Identifier);
                          $Pipeline = new Pipeline();
                  Severity: Major
                  Found in Application/Api/Billing/Bookkeeping/ApiBasket.php and 13 other locations - About 1 hr to fix
                  Application/Api/Billing/Accounting/ApiBankAccount.php on lines 121..137
                  Application/Api/Billing/Accounting/ApiBankReference.php on lines 125..141
                  Application/Api/Billing/Accounting/ApiCreditor.php on lines 189..205
                  Application/Api/Billing/Accounting/ApiCreditor.php on lines 213..229
                  Application/Api/Billing/Accounting/ApiDebtor.php on lines 128..144
                  Application/Api/Billing/Bookkeeping/ApiBasket.php on lines 251..267
                  Application/Api/Billing/Bookkeeping/ApiBasketVerification.php on lines 425..441
                  Application/Api/Billing/Inventory/ApiItem.php on lines 214..230
                  Application/Api/Billing/Inventory/ApiItem.php on lines 238..254
                  Application/Api/Billing/Inventory/ItemCalculation.php on lines 149..165
                  Application/Api/Billing/Inventory/ItemCalculation.php on lines 173..189
                  Application/Api/Billing/Inventory/ItemVariant.php on lines 148..164
                  Application/Api/Billing/Inventory/ItemVariant.php on lines 172..188

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 118.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 14 locations. Consider refactoring.
                  Open

                      public static function pipelineDeleteBasket($Identifier = '', $BasketId = '')
                      {
                  
                          $Receiver = self::receiverModal(null, $Identifier);
                          $Pipeline = new Pipeline();
                  Severity: Major
                  Found in Application/Api/Billing/Bookkeeping/ApiBasket.php and 13 other locations - About 1 hr to fix
                  Application/Api/Billing/Accounting/ApiBankAccount.php on lines 121..137
                  Application/Api/Billing/Accounting/ApiBankReference.php on lines 125..141
                  Application/Api/Billing/Accounting/ApiCreditor.php on lines 189..205
                  Application/Api/Billing/Accounting/ApiCreditor.php on lines 213..229
                  Application/Api/Billing/Accounting/ApiDebtor.php on lines 128..144
                  Application/Api/Billing/Bookkeeping/ApiBasket.php on lines 227..243
                  Application/Api/Billing/Bookkeeping/ApiBasketVerification.php on lines 425..441
                  Application/Api/Billing/Inventory/ApiItem.php on lines 214..230
                  Application/Api/Billing/Inventory/ApiItem.php on lines 238..254
                  Application/Api/Billing/Inventory/ItemCalculation.php on lines 149..165
                  Application/Api/Billing/Inventory/ItemCalculation.php on lines 173..189
                  Application/Api/Billing/Inventory/ItemVariant.php on lines 148..164
                  Application/Api/Billing/Inventory/ItemVariant.php on lines 172..188

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 118.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                      public static function pipelineCloseModal($Identifier = '')
                      {
                          $Pipeline = new Pipeline();
                          // reload the whole Table
                          $Emitter = new ServerEmitter(self::receiverContent(''), self::getEndpoint());
                  Severity: Major
                  Found in Application/Api/Billing/Bookkeeping/ApiBasket.php and 2 other locations - About 1 hr to fix
                  Application/Api/Billing/Accounting/ApiCreditor.php on lines 236..247
                  Application/Api/Billing/Inventory/ApiItem.php on lines 261..272

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 108.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                      public static function pipelineSaveAddBasket($Identifier = '')
                      {
                  
                          $Receiver = self::receiverModal(null, $Identifier);
                          $Pipeline = new Pipeline();
                  Severity: Major
                  Found in Application/Api/Billing/Bookkeeping/ApiBasket.php and 2 other locations - About 1 hr to fix
                  Application/Api/Billing/Accounting/ApiCreditor.php on lines 116..131
                  Application/Api/Billing/Inventory/ApiItem.php on lines 139..154

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 107.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      public function exportApi($Method = '')
                      {
                          $Dispatcher = new Dispatcher(__CLASS__);
                          // reload Panel content
                          $Dispatcher->registerMethod('getBasketTable');
                  Severity: Major
                  Found in Application/Api/Billing/Bookkeeping/ApiBasket.php and 1 other location - About 1 hr to fix
                  Application/Api/Contact/ApiRelationshipToCompany.php on lines 62..80

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 105.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      public static function pipelineBasketArchive($BasketId = '', $IsArchive = false)
                      {
                  
                          $Receiver = self::receiverService();
                          $Pipeline = new Pipeline();
                  Severity: Minor
                  Found in Application/Api/Billing/Bookkeeping/ApiBasket.php and 1 other location - About 40 mins to fix
                  Application/Api/Billing/Bookkeeping/ApiBasketVerification.php on lines 376..394

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 94.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  There are no issues that match your filters.

                  Category
                  Status