DerDu/SPHERE-Framework

View on GitHub
Application/Api/Document/AbstractDocument.php

Summary

Maintainability
F
2 wks
Test Coverage

Function allocatePersonParentsContact has a Cognitive Complexity of 143 (exceeds 5 allowed). Consider refactoring.
Open

    private function allocatePersonParentsContact(&$Data)
    {

        $Data['Person']['Contact']['All']['Mail'] = '';
        $Data['Person']['Contact']['All']['Person']['Mail'] = '';
Severity: Minor
Found in Application/Api/Document/AbstractDocument.php - About 2 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

Function allocateStudent has a Cognitive Complexity of 121 (exceeds 5 allowed). Consider refactoring.
Open

    private function allocateStudent(&$Data)
    {

        if ($this->getTblPerson()) {
            if (($tblDivisionList = Student::useService()->getCurrentDivisionListByPerson($this->getTblPerson()))) {
Severity: Minor
Found in Application/Api/Document/AbstractDocument.php - About 2 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

File AbstractDocument.php has 696 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
namespace SPHERE\Application\Api\Document;

use MOC\V\Component\Template\Component\IBridgeInterface;
use SPHERE\Application\Contact\Address\Address;
Severity: Major
Found in Application/Api/Document/AbstractDocument.php - About 1 day to fix

    Function setPhoneNumbersByTypeName has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
    Open

        private function setPhoneNumbersByTypeName(TblPerson $tblPerson, $TypeName = 'Privat')
        {
    
            $IsRemark = false;
            if($TypeName == 'Notfall'){
    Severity: Minor
    Found in Application/Api/Document/AbstractDocument.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 allocatePersonParentsContact has 129 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function allocatePersonParentsContact(&$Data)
        {
    
            $Data['Person']['Contact']['All']['Mail'] = '';
            $Data['Person']['Contact']['All']['Person']['Mail'] = '';
    Severity: Major
    Found in Application/Api/Document/AbstractDocument.php - About 5 hrs to fix

      Method allocateStudent has 108 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function allocateStudent(&$Data)
          {
      
              if ($this->getTblPerson()) {
                  if (($tblDivisionList = Student::useService()->getCurrentDivisionListByPerson($this->getTblPerson()))) {
      Severity: Major
      Found in Application/Api/Document/AbstractDocument.php - About 4 hrs to fix

        Function allocatePersonParents has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

            private function allocatePersonParents(&$Data)
            {
        
                if ($this->getTblPerson()) {
                    if (($tblRelationshipList = Relationship::useService()->getPersonRelationshipAllByPerson($this->getTblPerson()))) {
        Severity: Minor
        Found in Application/Api/Document/AbstractDocument.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

        Function allocateResponsibility has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

            private function allocateResponsibility(&$Data)
            {
                $tblPerson = $this->tblPerson;
                // pre fill found information (Responsibility)
                $Data['Responsibility']['Company']['Number'] = School::useService()->getCompanyNumber();
        Severity: Minor
        Found in Application/Api/Document/AbstractDocument.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

        Function getEmergencySlice has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function getEmergencySlice()
            {
        
                $slice = new Slice();
        
        
        Severity: Minor
        Found in Application/Api/Document/AbstractDocument.php - About 3 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

        AbstractDocument has 25 functions (exceeds 20 allowed). Consider refactoring.
        Open

        abstract class AbstractDocument
        {
        
            /** @var null|Frame $Document */
            private $Document = null;
        Severity: Minor
        Found in Application/Api/Document/AbstractDocument.php - About 2 hrs to fix

          Method getEmergencySlice has 62 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function getEmergencySlice()
              {
          
                  $slice = new Slice();
          
          
          Severity: Major
          Found in Application/Api/Document/AbstractDocument.php - About 2 hrs to fix

            Method setPhoneNumbersByTypeName has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function setPhoneNumbersByTypeName(TblPerson $tblPerson, $TypeName = 'Privat')
                {
            
                    $IsRemark = false;
                    if($TypeName == 'Notfall'){
            Severity: Minor
            Found in Application/Api/Document/AbstractDocument.php - About 2 hrs to fix

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

                  private function allocatePersonAuthorizedPersons(&$Data)
                  {
              
                      if ($this->getTblPerson()) {
                          if (($tblRelationshipList = Relationship::useService()->getPersonRelationshipAllByPerson($this->getTblPerson()))) {
              Severity: Minor
              Found in Application/Api/Document/AbstractDocument.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

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

                  private function allocatePersonMail(&$Data)
                  {
              
                      if ($this->getTblPerson()) {
                          if (($tblMailList = Mail::useService()->getMailAllByPerson($this->getTblPerson()))) {
              Severity: Minor
              Found in Application/Api/Document/AbstractDocument.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

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

                  private function allocatePersonCommon(&$Data)
                  {
              
                      if ($this->getTblPerson()) {
                          if (($tblCommon = Common::useService()->getCommonByPerson($this->getTblPerson()))
              Severity: Minor
              Found in Application/Api/Document/AbstractDocument.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 allocateResponsibility has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function allocateResponsibility(&$Data)
                  {
                      $tblPerson = $this->tblPerson;
                      // pre fill found information (Responsibility)
                      $Data['Responsibility']['Company']['Number'] = School::useService()->getCompanyNumber();
              Severity: Minor
              Found in Application/Api/Document/AbstractDocument.php - About 1 hr to fix

                Function getPhoneNumbers has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function getPhoneNumbers(TblPerson $tblPerson, TblType $tblType, &$phoneNumberList, $IsRemark = false) {
                        if (($tblPhoneToPersonList = Phone::useService()->getPhoneToPersonAllBy($tblPerson, $tblType))) {
                            foreach ($tblPhoneToPersonList as $tblPhoneToPerson) {
                                if (($tblPhone = $tblPhoneToPerson->getTblPhone())) {
                                    if($IsRemark){
                Severity: Minor
                Found in Application/Api/Document/AbstractDocument.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 allocatePersonParents has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function allocatePersonParents(&$Data)
                    {
                
                        if ($this->getTblPerson()) {
                            if (($tblRelationshipList = Relationship::useService()->getPersonRelationshipAllByPerson($this->getTblPerson()))) {
                Severity: Minor
                Found in Application/Api/Document/AbstractDocument.php - About 1 hr to fix

                  Method setCheckBox has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function setCheckBox(
                          $content = '&nbsp;',
                          $thicknessInnerLines = '0.5px'
                      )
                      {
                  Severity: Minor
                  Found in Application/Api/Document/AbstractDocument.php - About 1 hr to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                if ($tblAddress) {
                                                    $Data['Person']['Parent']['Father']['Address'] = $tblAddress->getGuiString();
                                                }
                    Severity: Major
                    Found in Application/Api/Document/AbstractDocument.php - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                  if ($tblPersonMother && $tblPersonMother->getId() == $tblFromPerson->getId()) {
                                                      foreach ($tblPhoneList as $tblToPersonPhone) {
                                                          if ($tblToPersonPhone->getTblType()->getName() == 'Privat'
                                                              && $tblToPersonPhone->getTblType()->getDescription() == 'Festnetz'
                                                          ) {
                      Severity: Major
                      Found in Application/Api/Document/AbstractDocument.php - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                    if ($tblAddress) {
                                                        $Data['Person']['Parent']['Mother']['Address'] = $tblAddress->getGuiString();
                                                    }
                        Severity: Major
                        Found in Application/Api/Document/AbstractDocument.php - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if (($tblStudentSchoolEnrollmentType = $tblTransfer->getTblStudentSchoolEnrollmentType())) {
                                                      if ($tblStudentSchoolEnrollmentType->getIdentifier() == 'POSTPONED') {
                                                          $Data['Student']['School']['Enrollment']['Postponed'] = 'X';
                                                      }
                                                      if ($tblStudentSchoolEnrollmentType->getIdentifier() == 'PREMATURE') {
                          Severity: Major
                          Found in Application/Api/Document/AbstractDocument.php - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                            if (($tblMail = $tblToPersonMail->getTblMail())) {
                                                                $Data['Person']['Contact']['All']['Person']['Mail'] .= $tblFromPerson->getLastFirstName().': '
                                                                    .$tblMail->getAddress().';<br/>';
                                                                // set next row if line ist to long
                                                                $ControlString = $Data['Person']['Contact']['All']['Mail'].
                            Severity: Major
                            Found in Application/Api/Document/AbstractDocument.php - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                          if ($tblPersonFather && $tblPersonFather->getId() == $tblFromPerson->getId()) {
                                                              foreach ($tblPhoneList as $tblToPersonPhone) {
                                                                  if ($tblToPersonPhone->getTblType()->getName() == 'Privat'
                                                                      && $tblToPersonPhone->getTblType()->getDescription() == 'Festnetz'
                                                                  ) {
                              Severity: Major
                              Found in Application/Api/Document/AbstractDocument.php - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                        if ($tblTransfer->getServiceTblType()) {
                                                            $Data['Student']['School']['Type'] = $tblTransfer->getServiceTblType()->getName();
                                                        }
                                Severity: Major
                                Found in Application/Api/Document/AbstractDocument.php - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                              if ($tblPhoneList) {
                                                                  $list = array();
                                                                  foreach ($tblPhoneList as $tblPhoneToPerson) {
                                                                      $list[] = $tblPhoneToPerson->getTblType()->getName() . ': '
                                                                          . $tblPhoneToPerson->getTblPhone()->getNumber();
                                  Severity: Major
                                  Found in Application/Api/Document/AbstractDocument.php - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                            if ($tblCompany && $tblSchoolType) {
                                                                $tblSchool = School::useService()->getSchoolByCompanyAndType($tblCompany, $tblSchoolType);
                                                                if ($tblSchool) {
                                                                    // fill found information (School)
                                                                    $Data['Responsibility']['Company']['Number'] = School::useService()->getCompanyNumber($tblSchool);
                                    Severity: Major
                                    Found in Application/Api/Document/AbstractDocument.php - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                              if (($tblCompany = $tblTransfer->getServiceTblCompany())) {
                                                                  if (($tblAddress = $tblCompany->fetchMainAddress())) {
                                                                      $Data['Document']['PlaceDate'] = $tblAddress->getTblCity()->getName() . ', '
                                                                          . date('d.m.Y');
                                                                      $Data['Document']['Date']['Now'] = date('d.m.Y');
                                      Severity: Major
                                      Found in Application/Api/Document/AbstractDocument.php - About 45 mins to fix

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

                                                                    if ($tblPersonMother && $tblPersonMother->getId() == $tblFromPerson->getId()) {
                                                                        foreach ($tblPhoneList as $tblToPersonPhone) {
                                                                            if ($tblToPersonPhone->getTblType()->getName() == 'Privat'
                                                                                && $tblToPersonPhone->getTblType()->getDescription() == 'Festnetz'
                                                                            ) {
                                        Severity: Major
                                        Found in Application/Api/Document/AbstractDocument.php and 1 other location - About 1 day to fix
                                        Application/Api/Document/AbstractDocument.php on lines 537..560

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

                                        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 ($tblPersonFather && $tblPersonFather->getId() == $tblFromPerson->getId()) {
                                                                        foreach ($tblPhoneList as $tblToPersonPhone) {
                                                                            if ($tblToPersonPhone->getTblType()->getName() == 'Privat'
                                                                                && $tblToPersonPhone->getTblType()->getDescription() == 'Festnetz'
                                                                            ) {
                                        Severity: Major
                                        Found in Application/Api/Document/AbstractDocument.php and 1 other location - About 1 day to fix
                                        Application/Api/Document/AbstractDocument.php on lines 513..536

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

                                        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

                                            protected function setCheckBox(
                                                $content = '&nbsp;',
                                                $thicknessInnerLines = '0.5px'
                                            )
                                            {
                                        Severity: Major
                                        Found in Application/Api/Document/AbstractDocument.php and 1 other location - About 4 hrs to fix
                                        Application/Api/Education/Certificate/Generator/Certificate.php on lines 3386..3415

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

                                        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 (!isset($Data['Person']['Parent']['Mother']['Name'])) {
                                                                    $Data['Person']['Parent']['Mother']['Name']['First'] = $tblFromPerson->getFirstSecondName();
                                                                    $Data['Person']['Parent']['Mother']['Name']['Last'] = $tblFromPerson->getLastName();
                                                                    $Data['Person']['Parent']['Mother']['Name']['LastFirst'] = $tblFromPerson->getLastFirstName();
                                                                    $tblAddress = Address::useService()->getAddressByPerson($tblFromPerson);
                                        Severity: Major
                                        Found in Application/Api/Document/AbstractDocument.php and 1 other location - About 2 hrs to fix
                                        Application/Api/Document/AbstractDocument.php on lines 401..409

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

                                        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

                                                                } elseif (!isset($Data['Person']['Parent']['Father']['Name'])) {
                                                                    $Data['Person']['Parent']['Father']['Name']['First'] = $tblFromPerson->getFirstSecondName();
                                                                    $Data['Person']['Parent']['Father']['Name']['Last'] = $tblFromPerson->getLastName();
                                                                    $Data['Person']['Parent']['Father']['Name']['LastFirst'] = $tblFromPerson->getLastFirstName();
                                                                    $tblAddress = Address::useService()->getAddressByPerson($tblFromPerson);
                                        Severity: Major
                                        Found in Application/Api/Document/AbstractDocument.php and 1 other location - About 2 hrs to fix
                                        Application/Api/Document/AbstractDocument.php on lines 393..409

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

                                        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