DerDu/SPHERE-Framework

View on GitHub
Application/Api/Billing/Accounting/ApiDebtor.php

Summary

Maintainability
F
5 days
Test Coverage

Function formDebtorNumber has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
Open

    public function formDebtorNumber($Identifier = '', $PersonId = '', $DebtorNumberId = '')
    {

        // choose between Add and Edit
        $SaveButton = new Primary('Speichern', self::getEndpoint(), new Save());
Severity: Minor
Found in Application/Api/Billing/Accounting/ApiDebtor.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 ApiDebtor.php has 401 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
namespace SPHERE\Application\Api\Billing\Accounting;

use SPHERE\Application\Api\ApiTrait;
use SPHERE\Application\Api\Dispatcher;
Severity: Minor
Found in Application/Api/Billing/Accounting/ApiDebtor.php - About 5 hrs to fix

    Method formDebtorNumber has 86 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function formDebtorNumber($Identifier = '', $PersonId = '', $DebtorNumberId = '')
        {
    
            // choose between Add and Edit
            $SaveButton = new Primary('Speichern', self::getEndpoint(), new Save());
    Severity: Major
    Found in Application/Api/Billing/Accounting/ApiDebtor.php - About 3 hrs to fix

      Function checkInputDebtorNumber has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          private function checkInputDebtorNumber($Identifier = '', $PersonId = '', $DebtorNumberId = '',
              $DebtorNumber = array()
          ){
      
              $Error = false;
      Severity: Minor
      Found in Application/Api/Billing/Accounting/ApiDebtor.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 showDeleteDebtorNumber has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function showDeleteDebtorNumber($Identifier = '', $PersonId = '', $DebtorNumberId = '')
          {
      
              $tblDebtorNumber = Debtor::useService()->getDebtorNumberById($DebtorNumberId);
      
      
      Severity: Minor
      Found in Application/Api/Billing/Accounting/ApiDebtor.php - About 1 hr to fix

        Method checkInputDebtorNumber has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function checkInputDebtorNumber($Identifier = '', $PersonId = '', $DebtorNumberId = '',
                $DebtorNumber = array()
            ){
        
                $Error = false;
        Severity: Minor
        Found in Application/Api/Billing/Accounting/ApiDebtor.php - About 1 hr to fix

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

              public function saveAddDebtorNumber($Identifier = '', $PersonId = '', $DebtorNumber = array())
              {
          
                  // Handle error's
                  if($form = $this->checkInputDebtorNumber($Identifier, $PersonId, '', $DebtorNumber)){
          Severity: Minor
          Found in Application/Api/Billing/Accounting/ApiDebtor.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

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

              public static function pipelineOpenEditDebtorNumberModal($Identifier = '', $PersonId = '', $DebtorNumberId = '',
                  $DebtorNumber = array()
              ){
          
                  $Receiver = self::receiverModal(null, $Identifier);
          Severity: Major
          Found in Application/Api/Billing/Accounting/ApiDebtor.php and 2 other locations - About 3 hrs to fix
          Application/Api/Billing/Accounting/ApiBankAccount.php on lines 147..166
          Application/Api/Billing/Accounting/ApiBankReference.php on lines 151..170

          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 147.

          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 pipelineSaveEditDebtorNumber($Identifier = '', $PersonId = '', $DebtorNumberId = '')
              {
          
                  $Receiver = self::receiverModal(null, $Identifier);
                  $Pipeline = new Pipeline(true);
          Severity: Major
          Found in Application/Api/Billing/Accounting/ApiDebtor.php and 2 other locations - About 2 hrs to fix
          Application/Api/Billing/Accounting/ApiBankAccount.php on lines 175..193
          Application/Api/Billing/Accounting/ApiBankReference.php on lines 179..196

          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 135.

          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 pipelineOpenAddDebtorNumberModal($Identifier = '', $PersonId = '', $DebtorNumber = array())
              {
          
                  $Receiver = self::receiverModal(null, $Identifier);
                  $Pipeline = new Pipeline();
          Severity: Major
          Found in Application/Api/Billing/Accounting/ApiDebtor.php and 2 other locations - About 2 hrs to fix
          Application/Api/Billing/Accounting/ApiBankAccount.php on lines 96..113
          Application/Api/Billing/Accounting/ApiBankReference.php on lines 100..117

          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 130.

          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 7 locations. Consider refactoring.
          Open

              public static function pipelineDeleteDebtorNumber($Identifier = '', $PersonId = '', $DebtorNumberId = '')
              {
          
                  $Receiver = self::receiverModal(null, $Identifier);
                  $Pipeline = new Pipeline();
          Severity: Major
          Found in Application/Api/Billing/Accounting/ApiDebtor.php and 6 other locations - About 2 hrs to fix
          Application/Api/Billing/Accounting/ApiBankAccount.php on lines 202..219
          Application/Api/Billing/Accounting/ApiBankAccount.php on lines 228..245
          Application/Api/Billing/Accounting/ApiBankReference.php on lines 205..222
          Application/Api/Billing/Accounting/ApiBankReference.php on lines 231..248
          Application/Api/Billing/Accounting/ApiDebtor.php on lines 208..225
          Application/Api/Billing/Accounting/ApiDebtorSelection.php on lines 146..163

          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 129.

          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 7 locations. Consider refactoring.
          Open

              public static function pipelineOpenDeleteDebtorNumberModal($Identifier = '', $PersonId = '', $DebtorNumberId = '')
              {
          
                  $Receiver = self::receiverModal(null, $Identifier);
                  $Pipeline = new Pipeline();
          Severity: Major
          Found in Application/Api/Billing/Accounting/ApiDebtor.php and 6 other locations - About 2 hrs to fix
          Application/Api/Billing/Accounting/ApiBankAccount.php on lines 202..219
          Application/Api/Billing/Accounting/ApiBankAccount.php on lines 228..245
          Application/Api/Billing/Accounting/ApiBankReference.php on lines 205..222
          Application/Api/Billing/Accounting/ApiBankReference.php on lines 231..248
          Application/Api/Billing/Accounting/ApiDebtor.php on lines 234..251
          Application/Api/Billing/Accounting/ApiDebtorSelection.php on lines 146..163

          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 129.

          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 = '', $PersonId = '')
              {
                  $Pipeline = new Pipeline();
                  // reload the whole Table
                  $Emitter = new ServerEmitter(self::receiverPanelContent(''), self::getEndpoint());
          Severity: Major
          Found in Application/Api/Billing/Accounting/ApiDebtor.php and 2 other locations - About 2 hrs to fix
          Application/Api/Billing/Accounting/ApiBankAccount.php on lines 253..267
          Application/Api/Billing/Accounting/ApiBankReference.php on lines 256..270

          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 129.

          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

                      return new Layout(
                          new LayoutGroup(
                              new LayoutRow(array(
                                  new LayoutColumn(
                                      new Panel('Soll die Debitorennummer wirklich entfernt werden?'
          Severity: Major
          Found in Application/Api/Billing/Accounting/ApiDebtor.php and 2 other locations - About 1 hr to fix
          Application/Api/Billing/Accounting/ApiBankAccount.php on lines 500..515
          Application/Api/Billing/Accounting/ApiBankReference.php on lines 510..525

          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 119.

          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 pipelineSaveAddDebtorNumber($Identifier = '', $PersonId = '')
              {
          
                  $Receiver = self::receiverModal(null, $Identifier);
                  $Pipeline = new Pipeline();
          Severity: Major
          Found in Application/Api/Billing/Accounting/ApiDebtor.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/Bookkeeping/ApiBasket.php on lines 227..243
          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

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

                          if($tblToPersonList){
                              /* @var TblToPerson $tblToPerson */
                              foreach($tblToPersonList as $tblToPerson) {
                                  $tblPersonStudent = $tblToPerson->getServiceTblPersonTo();
                                  if(($tblStudent = Student::useService()->getStudentByPerson($tblPersonStudent))){
          Severity: Minor
          Found in Application/Api/Billing/Accounting/ApiDebtor.php and 1 other location - About 40 mins to fix
          Application/Api/Billing/Accounting/ApiDebtor.php on lines 350..361

          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

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

                          if($tblToPersonList){
                              /* @var TblToPerson $tblToPerson */
                              foreach($tblToPersonList as $tblToPerson) {
                                  $tblPersonStudent = $tblToPerson->getServiceTblPersonTo();
                                  if(($tblStudent = Student::useService()->getStudentByPerson($tblPersonStudent))){
          Severity: Minor
          Found in Application/Api/Billing/Accounting/ApiDebtor.php and 1 other location - About 40 mins to fix
          Application/Api/Billing/Accounting/ApiDebtor.php on lines 334..345

          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

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

                      if(($tblDebtorNumber = Debtor::useService()->getDebtorNumberByNumber($DebtorNumber['Number']))){
                          $tblPerson = Person::useService()->getPersonById($PersonId);
                          if($tblPerson && ($tblPersonCompare = $tblDebtorNumber->getServiceTblPerson())
                              && $tblPerson->getId() !== $tblPersonCompare->getId()){
                              $form->setError('DebtorNumber[Number]',
          Severity: Minor
          Found in Application/Api/Billing/Accounting/ApiDebtor.php and 1 other location - About 35 mins to fix
          Application/Api/Billing/Accounting/ApiBankReference.php on lines 352..360

          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 92.

          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