Covivo/mobicoop

View on GitHub
api/src/Carpool/Service/ProofManager.php

Summary

Maintainability
F
3 days
Test Coverage

ProofManager has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

class ProofManager
{
    private $entityManager;
    private $logger;
    private $provider;
Severity: Minor
Found in api/src/Carpool/Service/ProofManager.php - About 2 hrs to fix

    Avoid deeply nested control flow statements.
    Open

                                        if (is_null($ask->getCriteria()->getTueTime())) {
                                            break;
                                        }
    Severity: Major
    Found in api/src/Carpool/Service/ProofManager.php - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                          if (is_null($ask->getCriteria()->getSunTime())) {
                                              break;
                                          }
      Severity: Major
      Found in api/src/Carpool/Service/ProofManager.php - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                            if (is_null($ask->getCriteria()->getFriTime())) {
                                                break;
                                            }
        Severity: Major
        Found in api/src/Carpool/Service/ProofManager.php - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                              if (is_null($ask->getCriteria()->getThuTime())) {
                                                  break;
                                              }
          Severity: Major
          Found in api/src/Carpool/Service/ProofManager.php - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                                if (is_null($ask->getCriteria()->getSatTime())) {
                                                    break;
                                                }
            Severity: Major
            Found in api/src/Carpool/Service/ProofManager.php - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                                  if (is_null($ask->getCriteria()->getMonTime())) {
                                                      break;
                                                  }
              Severity: Major
              Found in api/src/Carpool/Service/ProofManager.php - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                                    if (is_null($ask->getCriteria()->getWedTime())) {
                                                        break;
                                                    }
                Severity: Major
                Found in api/src/Carpool/Service/ProofManager.php - About 45 mins to fix

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

                                  if (!is_null($carpoolProof->getPickUpPassengerAddress())) {
                                      // the passenger has set its pickup
                                      if (!is_null($carpoolProof->getDropOffPassengerAddress())) {
                                          // the passenger has already certified its pickup and dropoff
                                          throw new ProofException('The passenger has already sent its dropoff certification');
                  Severity: Major
                  Found in api/src/Carpool/Service/ProofManager.php and 1 other location - About 5 hrs to fix
                  api/src/Carpool/Service/ProofManager.php on lines 434..486

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

                  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 (!is_null($carpoolProof->getPickUpDriverAddress())) {
                                      // the driver has set its pickup
                                      if (!is_null($carpoolProof->getDropOffDriverAddress())) {
                                          // the driver has already certified its pickup and dropoff
                                          throw new ProofException('The driver has already sent its dropoff certification');
                  Severity: Major
                  Found in api/src/Carpool/Service/ProofManager.php and 1 other location - About 5 hrs to fix
                  api/src/Carpool/Service/ProofManager.php on lines 496..557

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

                  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

                                              case 3:     // wednesday
                                                  if ($ask->getCriteria()->isWedCheck()) {
                                                      // we check if time is set, could not be the case if ask criteria is different than proposal or matching criteria
                                                      // if time is not set we consider that the day is not carpooled
                                                      if (is_null($ask->getCriteria()->getWedTime())) {
                  Severity: Major
                  Found in api/src/Carpool/Service/ProofManager.php and 6 other locations - About 1 hr to fix
                  api/src/Carpool/Service/ProofManager.php on lines 1281..1293
                  api/src/Carpool/Service/ProofManager.php on lines 1295..1307
                  api/src/Carpool/Service/ProofManager.php on lines 1309..1321
                  api/src/Carpool/Service/ProofManager.php on lines 1337..1349
                  api/src/Carpool/Service/ProofManager.php on lines 1351..1363
                  api/src/Carpool/Service/ProofManager.php on lines 1365..1377

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

                  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

                                              case 1:     // monday
                                                  if ($ask->getCriteria()->isMonCheck()) {
                                                      // we check if time is set, could not be the case if ask criteria is different than proposal or matching criteria
                                                      // if time is not set we consider that the day is not carpooled
                                                      if (is_null($ask->getCriteria()->getMonTime())) {
                  Severity: Major
                  Found in api/src/Carpool/Service/ProofManager.php and 6 other locations - About 1 hr to fix
                  api/src/Carpool/Service/ProofManager.php on lines 1281..1293
                  api/src/Carpool/Service/ProofManager.php on lines 1309..1321
                  api/src/Carpool/Service/ProofManager.php on lines 1323..1335
                  api/src/Carpool/Service/ProofManager.php on lines 1337..1349
                  api/src/Carpool/Service/ProofManager.php on lines 1351..1363
                  api/src/Carpool/Service/ProofManager.php on lines 1365..1377

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

                  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

                                              case 2:     // tuesday
                                                  if ($ask->getCriteria()->isTueCheck()) {
                                                      // we check if time is set, could not be the case if ask criteria is different than proposal or matching criteria
                                                      // if time is not set we consider that the day is not carpooled
                                                      if (is_null($ask->getCriteria()->getTueTime())) {
                  Severity: Major
                  Found in api/src/Carpool/Service/ProofManager.php and 6 other locations - About 1 hr to fix
                  api/src/Carpool/Service/ProofManager.php on lines 1281..1293
                  api/src/Carpool/Service/ProofManager.php on lines 1295..1307
                  api/src/Carpool/Service/ProofManager.php on lines 1323..1335
                  api/src/Carpool/Service/ProofManager.php on lines 1337..1349
                  api/src/Carpool/Service/ProofManager.php on lines 1351..1363
                  api/src/Carpool/Service/ProofManager.php on lines 1365..1377

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

                  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

                                              case 5:     // friday
                                                  if ($ask->getCriteria()->isFriCheck()) {
                                                      // we check if time is set, could not be the case if ask criteria is different than proposal or matching criteria
                                                      // if time is not set we consider that the day is not carpooled
                                                      if (is_null($ask->getCriteria()->getFriTime())) {
                  Severity: Major
                  Found in api/src/Carpool/Service/ProofManager.php and 6 other locations - About 1 hr to fix
                  api/src/Carpool/Service/ProofManager.php on lines 1281..1293
                  api/src/Carpool/Service/ProofManager.php on lines 1295..1307
                  api/src/Carpool/Service/ProofManager.php on lines 1309..1321
                  api/src/Carpool/Service/ProofManager.php on lines 1323..1335
                  api/src/Carpool/Service/ProofManager.php on lines 1337..1349
                  api/src/Carpool/Service/ProofManager.php on lines 1365..1377

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

                  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

                                              case 0:     // sunday
                                                  if ($ask->getCriteria()->isSunCheck()) {
                                                      // we check if time is set, could not be the case if ask criteria is different than proposal or matching criteria
                                                      // if time is not set we consider that the day is not carpooled
                                                      if (is_null($ask->getCriteria()->getSunTime())) {
                  Severity: Major
                  Found in api/src/Carpool/Service/ProofManager.php and 6 other locations - About 1 hr to fix
                  api/src/Carpool/Service/ProofManager.php on lines 1295..1307
                  api/src/Carpool/Service/ProofManager.php on lines 1309..1321
                  api/src/Carpool/Service/ProofManager.php on lines 1323..1335
                  api/src/Carpool/Service/ProofManager.php on lines 1337..1349
                  api/src/Carpool/Service/ProofManager.php on lines 1351..1363
                  api/src/Carpool/Service/ProofManager.php on lines 1365..1377

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

                  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

                                              case 6:     // saturday
                                                  if ($ask->getCriteria()->isSatCheck()) {
                                                      // we check if time is set, could not be the case if ask criteria is different than proposal or matching criteria
                                                      // if time is not set we consider that the day is not carpooled
                                                      if (is_null($ask->getCriteria()->getSatTime())) {
                  Severity: Major
                  Found in api/src/Carpool/Service/ProofManager.php and 6 other locations - About 1 hr to fix
                  api/src/Carpool/Service/ProofManager.php on lines 1281..1293
                  api/src/Carpool/Service/ProofManager.php on lines 1295..1307
                  api/src/Carpool/Service/ProofManager.php on lines 1309..1321
                  api/src/Carpool/Service/ProofManager.php on lines 1323..1335
                  api/src/Carpool/Service/ProofManager.php on lines 1337..1349
                  api/src/Carpool/Service/ProofManager.php on lines 1351..1363

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

                  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

                                              case 4:     // thursday
                                                  if ($ask->getCriteria()->isThuCheck()) {
                                                      // we check if time is set, could not be the case if ask criteria is different than proposal or matching criteria
                                                      // if time is not set we consider that the day is not carpooled
                                                      if (is_null($ask->getCriteria()->getThuTime())) {
                  Severity: Major
                  Found in api/src/Carpool/Service/ProofManager.php and 6 other locations - About 1 hr to fix
                  api/src/Carpool/Service/ProofManager.php on lines 1281..1293
                  api/src/Carpool/Service/ProofManager.php on lines 1295..1307
                  api/src/Carpool/Service/ProofManager.php on lines 1309..1321
                  api/src/Carpool/Service/ProofManager.php on lines 1323..1335
                  api/src/Carpool/Service/ProofManager.php on lines 1351..1363
                  api/src/Carpool/Service/ProofManager.php on lines 1365..1377

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

                  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