DerDu/SPHERE-Framework

View on GitHub
Application/Transfer/Import/LebensweltZwenkau/Service.php

Summary

Maintainability
F
1 wk
Test Coverage

Function processRow has a Cognitive Complexity of 200 (exceeds 5 allowed). Consider refactoring.
Open

    private function processRow(
        PhpExcel $Document,
        $Location,
        $RunY,
        $countPerson,
Severity: Minor
Found in Application/Transfer/Import/LebensweltZwenkau/Service.php - About 4 days 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 processRow has 431 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function processRow(
        PhpExcel $Document,
        $Location,
        $RunY,
        $countPerson,
Severity: Major
Found in Application/Transfer/Import/LebensweltZwenkau/Service.php - About 2 days to fix

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

    <?php
    /**
     * Created by PhpStorm.
     * User: Kauschke
     * Date: 01.06.2016
    Severity: Major
    Found in Application/Transfer/Import/LebensweltZwenkau/Service.php - About 1 day to fix

      Function createPersonsFromFile has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
      Open

          public function createPersonsFromFile(
              IFormInterface $Form = null,
              UploadedFile $File = null
          ) {
      
      
      Severity: Minor
      Found in Application/Transfer/Import/LebensweltZwenkau/Service.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

      Method createPersonsFromFile has 131 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function createPersonsFromFile(
              IFormInterface $Form = null,
              UploadedFile $File = null
          ) {
      
      
      Severity: Major
      Found in Application/Transfer/Import/LebensweltZwenkau/Service.php - About 5 hrs to fix

        Method processRow has 17 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                PhpExcel $Document,
                $Location,
                $RunY,
                $countPerson,
                $countCompany,
        Severity: Major
        Found in Application/Transfer/Import/LebensweltZwenkau/Service.php - About 2 hrs to fix

          Avoid deeply nested control flow statements.
          Open

                                      if ($arriveDate !== '') {
                                          $arriveDate = date('Y-m-d',
                                              \PHPExcel_Shared_Date::ExcelToPHP($arriveDate));
                                          $tblStudent = Student::useService()->insertStudent(
                                              $tblPerson, ''
          Severity: Major
          Found in Application/Transfer/Import/LebensweltZwenkau/Service.php - About 45 mins to fix

            Avoid too many return statements within this method.
            Open

                    return new Danger('File nicht gefunden');
            Severity: Major
            Found in Application/Transfer/Import/LebensweltZwenkau/Service.php - About 30 mins to fix

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

                                  if ($tblYear) {
                                      $tblPeriodList = Term::useService()->getPeriodAllByYear($tblYear);
                                      if (!$tblPeriodList) {
                                          // firstTerm
                                          $tblPeriod = Term::useService()->insertPeriod(
              Severity: Major
              Found in Application/Transfer/Import/LebensweltZwenkau/Service.php and 5 other locations - About 3 hrs to fix
              Application/Transfer/Import/Annaberg/Service.php on lines 620..643
              Application/Transfer/Import/Annaberg/Service.php on lines 646..669
              Application/Transfer/Import/BadDueben/Service.php on lines 938..961
              Application/Transfer/Import/Naundorf/Service.php on lines 760..783
              Application/Transfer/Import/Service.php on lines 48..71

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

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

                              if ($phoneNumber !== '') {
                                  $phoneNumberList = explode(';', $phoneNumber);
                                  foreach ($phoneNumberList as $phone) {
                                      $phone = trim($phone);
                                      $tblType = Phone::useService()->getTypeById(1);
              Severity: Major
              Found in Application/Transfer/Import/LebensweltZwenkau/Service.php and 4 other locations - About 2 hrs to fix
              Application/Transfer/Import/Schneeberg/Service.php on lines 416..431
              Application/Transfer/Import/Schneeberg/Service.php on lines 435..450
              Application/Transfer/Import/Tharandt/Service.php on lines 1113..1128
              Application/Transfer/Import/Zwickau/Service.php on lines 1550..1565

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

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

                              Common::useService()->insertMeta(
                                  $tblPerson,
                                  $birthdayDate,
                                  trim($Document->getValue($Document->getCell($Location['Geburtsort'], $RunY))),
                                  $gender,
              Severity: Major
              Found in Application/Transfer/Import/LebensweltZwenkau/Service.php and 4 other locations - About 1 hr to fix
              Application/Transfer/Import/Radebeul/Service.php on lines 357..370
              Application/Transfer/Import/Radebeul/Service.php on lines 1987..2000
              Application/Transfer/Import/Schneeberg/Service.php on lines 915..928
              Application/Transfer/Import/Seelitz/Service.php on lines 202..215

              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

                              if ($custody3 !== '') {
                                  if (isset($tblPersonList[$custody3])) {
                                      Relationship::useService()->insertRelationshipToPerson(
                                          $tblPerson,
                                          Person::useService()->getPersonById($tblPersonList[$custody3]),
              Severity: Major
              Found in Application/Transfer/Import/LebensweltZwenkau/Service.php and 2 other locations - About 1 hr to fix
              Application/Transfer/Import/LebensweltZwenkau/Service.php on lines 328..340
              Application/Transfer/Import/LebensweltZwenkau/Service.php on lines 343..355

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

              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

                              if ($custody1 !== '') {
                                  if (isset($tblPersonList[$custody1])) {
                                      Relationship::useService()->insertRelationshipToPerson(
                                          $tblPerson,
                                          Person::useService()->getPersonById($tblPersonList[$custody1]),
              Severity: Major
              Found in Application/Transfer/Import/LebensweltZwenkau/Service.php and 2 other locations - About 1 hr to fix
              Application/Transfer/Import/LebensweltZwenkau/Service.php on lines 343..355
              Application/Transfer/Import/LebensweltZwenkau/Service.php on lines 358..370

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

              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

                              if ($custody2 !== '') {
                                  if (isset($tblPersonList[$custody2])) {
                                      Relationship::useService()->insertRelationshipToPerson(
                                          $tblPerson,
                                          Person::useService()->getPersonById($tblPersonList[$custody2]),
              Severity: Major
              Found in Application/Transfer/Import/LebensweltZwenkau/Service.php and 2 other locations - About 1 hr to fix
              Application/Transfer/Import/LebensweltZwenkau/Service.php on lines 328..340
              Application/Transfer/Import/LebensweltZwenkau/Service.php on lines 358..370

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

              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 ($leaveDate !== '') {
                                      $leaveDate = date('Y-m-d', \PHPExcel_Shared_Date::ExcelToPHP($leaveDate));
              
                                      if ($tblStudent) {
                                          $tblStudentTransferType = Student::useService()->getStudentTransferTypeByIdentifier('LEAVE');
              Severity: Minor
              Found in Application/Transfer/Import/LebensweltZwenkau/Service.php and 1 other location - About 45 mins to fix
              Application/Transfer/Import/LebensweltZwenkau/Service.php on lines 515..530

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

              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 ($arriveDate !== '') {
                                      $arriveDate = date('Y-m-d', \PHPExcel_Shared_Date::ExcelToPHP($arriveDate));
              
                                      if ($tblStudent) {
                                          $tblStudentTransferType = Student::useService()->getStudentTransferTypeByIdentifier('ARRIVE');
              Severity: Minor
              Found in Application/Transfer/Import/LebensweltZwenkau/Service.php and 1 other location - About 45 mins to fix
              Application/Transfer/Import/LebensweltZwenkau/Service.php on lines 534..549

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

              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