DerDu/SPHERE-Framework

View on GitHub
Application/People/Relationship/Service.php

Summary

Maintainability
F
4 days
Test Coverage

Function getPersonGuardianAllByToPersonList has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
Open

    public function getPersonGuardianAllByToPersonList($tblToPersonList)
    {

        $GuardianList = array();
        if ($tblToPersonList && !empty($tblToPersonList)) {
Severity: Minor
Found in Application/People/Relationship/Service.php - About 7 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

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

<?php
namespace SPHERE\Application\People\Relationship;

use SPHERE\Application\Corporation\Company\Company;
use SPHERE\Application\Corporation\Company\Service\Entity\TblCompany;
Severity: Minor
Found in Application/People/Relationship/Service.php - About 6 hrs to fix

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

    class Service extends AbstractService
    {
    
        /**
         * @return false|ViewRelationshipToPerson[]
    Severity: Minor
    Found in Application/People/Relationship/Service.php - About 4 hrs to fix

      Function checkFormRelationshipToPerson has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          public function checkFormRelationshipToPerson(
              TblPerson $tblPerson,
              $Type,
              $To,
              TblToPerson $tblToPerson = null,
      Severity: Minor
      Found in Application/People/Relationship/Service.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

      Function checkGuardianRelationshipsForPerson has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          private function checkGuardianRelationshipsForPerson(TblPerson $tblPersonChild, TblPerson $tblPersonGuardian, $Ranking, $IsSingleParent)
          {
      
              $result = array();
              if (($tblType = $this->getTypeByName(TblType::IDENTIFIER_GUARDIAN))
      Severity: Minor
      Found in Application/People/Relationship/Service.php - About 2 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 checkFormRelationshipToPerson has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function checkFormRelationshipToPerson(
              TblPerson $tblPerson,
              $Type,
              $To,
              TblToPerson $tblToPerson = null,
      Severity: Major
      Found in Application/People/Relationship/Service.php - About 2 hrs to fix

        Method getPersonGuardianAllByToPersonList has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getPersonGuardianAllByToPersonList($tblToPersonList)
            {
        
                $GuardianList = array();
                if ($tblToPersonList && !empty($tblToPersonList)) {
        Severity: Minor
        Found in Application/People/Relationship/Service.php - About 1 hr to fix

          Method checkFormRelationshipToCompany has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function checkFormRelationshipToCompany(
                  TblPerson $tblPerson,
                  $Type,
                  $To,
                  TblToCompany $tblToCompany = null,
          Severity: Minor
          Found in Application/People/Relationship/Service.php - About 1 hr to fix

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

                    TblPerson $tblPerson,
                    $Type,
                    $To,
                    TblToPerson $tblToPerson = null,
                    $Search = ''
            Severity: Minor
            Found in Application/People/Relationship/Service.php - About 35 mins to fix

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

                      TblPerson $tblPerson,
                      $Type,
                      $To,
                      TblToCompany $tblToCompany = null,
                      $Search = ''
              Severity: Minor
              Found in Application/People/Relationship/Service.php - About 35 mins to fix

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

                        TblPerson $tblPersonFrom,
                        TblPerson $tblPersonTo,
                        TblType $tblType,
                        $Remark,
                        $Ranking = null
                Severity: Minor
                Found in Application/People/Relationship/Service.php - About 35 mins to fix

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

                      public function createRelationshipToPerson(
                          TblPerson $tblPersonFrom,
                          TblPerson $tblPersonTo,
                          $Type
                      ) {
                  Severity: Minor
                  Found in Application/People/Relationship/Service.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

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

                      public function checkFormRelationshipToCompany(
                          TblPerson $tblPerson,
                          $Type,
                          $To,
                          TblToCompany $tblToCompany = null,
                  Severity: Minor
                  Found in Application/People/Relationship/Service.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

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

                      public function removeRelationshipAllByPerson(TblPerson $tblPerson, $IsSoftRemove = false)
                      {
                  
                          if (($tblRelationshipToPersonList = $this->getPersonRelationshipAllByPerson($tblPerson))){
                              foreach($tblRelationshipToPersonList as $tblToPerson){
                  Severity: Minor
                  Found in Application/People/Relationship/Service.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

                  There are no issues that match your filters.

                  Category
                  Status