Covivo/mobicoop

View on GitHub
api/src/Match/Service/MassImportManager.php

Summary

Maintainability
D
3 days
Test Coverage

Avoid deeply nested control flow statements.
Open

                        if (method_exists($personalAddress, $setter)) {
                            $personalAddress->{$setter}(strtoupper($tab[$i]));
                        }
Severity: Major
Found in api/src/Match/Service/MassImportManager.php - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if ('' !== $tab[$i]) {
                                $massPerson->{$setter}($tab[$i]);
                            }
    Severity: Major
    Found in api/src/Match/Service/MassImportManager.php - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if (method_exists($workAddress, $setter)) {
                                  $workAddress->{$setter}(strtoupper($tab[$i]));
                              }
      Severity: Major
      Found in api/src/Match/Service/MassImportManager.php - About 45 mins to fix

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

                        foreach ($destinations as $key => $destination) {
                            if (
                                $destination['houseNumber'] == $massPerson->getWorkAddress()->getHouseNumber()
                                && $destination['street'] == $massPerson->getWorkAddress()->getStreet()
                                && $destination['postalCode'] == $massPerson->getWorkAddress()->getPostalCode()
        Severity: Major
        Found in api/src/Match/Service/MassImportManager.php and 1 other location - About 5 hrs to fix
        api/src/Match/Service/MassImportManager.php on lines 297..311

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

        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

                            foreach ($origins as $key => $origin) {
                                if (
                                    $origin['houseNumber'] == $massPerson->getPersonalAddress()->getHouseNumber()
                                    && $origin['street'] == $massPerson->getPersonalAddress()->getStreet()
                                    && $origin['postalCode'] == $massPerson->getPersonalAddress()->getPostalCode()
        Severity: Major
        Found in api/src/Match/Service/MassImportManager.php and 1 other location - About 5 hrs to fix
        api/src/Match/Service/MassImportManager.php on lines 345..359

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

        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 ('outwardTime' == $fields[$i] && '' !== $tab[$i]) {
                                $outwardtime = \DateTime::createFromFormat('H:i', $tab[$i]);
                                if (!$outwardtime) {
                                    $error = true;
                                    $errors[] = [
        Severity: Major
        Found in api/src/Match/Service/MassImportManager.php and 1 other location - About 1 hr to fix
        api/src/Match/Service/MassImportManager.php on lines 1021..1034

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

                            } elseif ('returnTime' == $fields[$i] && '' !== $tab[$i]) {
                                $returntime = \DateTime::createFromFormat('H:i', $tab[$i]);
                                if (!$returntime) {
                                    $error = true;
                                    $errors[] = [
        Severity: Major
        Found in api/src/Match/Service/MassImportManager.php and 1 other location - About 1 hr to fix
        api/src/Match/Service/MassImportManager.php on lines 1006..1019

        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

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

                if ($matches = $this->geoMatcher->multiMatch($candidates, true)) {
                    if (is_array($matches) && count($matches) > 0) {
                        foreach ($matches as $match) {
                            foreach ($match['matches'] as $matched) {
                                $insertValues[] = [
        Severity: Major
        Found in api/src/Match/Service/MassImportManager.php and 1 other location - About 1 hr to fix
        api/src/Match/Service/MassImportManager.php on lines 603..616

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

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

                        if ($matches = $this->geoMatcher->multiMatch($candidates, true)) {
                            if (is_array($matches) && count($matches) > 0) {
                                foreach ($matches as $match) {
                                    foreach ($match['matches'] as $matched) {
                                        $insertValues[] = [
        Severity: Major
        Found in api/src/Match/Service/MassImportManager.php and 1 other location - About 1 hr to fix
        api/src/Match/Service/MassImportManager.php on lines 634..647

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

        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($passengerPerson->getDistance()) || (0 == $passengerPerson->getDistance())
                            || is_null($passengerPerson->getDuration()) || (0 == $passengerPerson->getDuration())
                            || is_null($passengerPerson->getBboxMinLon())
                            || is_null($passengerPerson->getBboxMinLat())
        Severity: Major
        Found in api/src/Match/Service/MassImportManager.php and 1 other location - About 1 hr to fix
        api/src/Match/Service/MassImportManager.php on lines 495..503

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

        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($driverPerson->getDistance()) || (0 == $driverPerson->getDistance())
                        || is_null($driverPerson->getDuration()) || (0 == $driverPerson->getDuration())
                        || is_null($driverPerson->getBboxMinLon())
                        || is_null($driverPerson->getBboxMinLat())
        Severity: Major
        Found in api/src/Match/Service/MassImportManager.php and 1 other location - About 1 hr to fix
        api/src/Match/Service/MassImportManager.php on lines 534..542

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

        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

            private function print_mem($id)
            {
                // Currently used memory
                $mem_usage = memory_get_usage();
        
        
        Severity: Major
        Found in api/src/Match/Service/MassImportManager.php and 2 other locations - About 55 mins to fix
        api/src/Carpool/Service/ProposalMatcher.php on lines 2209..2218
        api/src/Geography/RouterProvider/GraphhopperProvider.php on lines 751..760

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

        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

                    $input = trim(str_replace(
                        ',',
                        '',
                        trim($destination['houseNumber']).' '.trim($destination['street']).' '.trim($destination['postalCode']).' '.trim($destination['addressLocality'])
                    ));
        Severity: Minor
        Found in api/src/Match/Service/MassImportManager.php and 1 other location - About 45 mins to fix
        api/src/Match/Service/MassImportManager.php on lines 272..276

        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

                            $input = trim(str_replace(
                                ',',
                                '',
                                trim($origin['houseNumber']).' '.trim($origin['street']).' '.trim($origin['postalCode']).' '.trim($origin['addressLocality'])
                            ));
        Severity: Minor
        Found in api/src/Match/Service/MassImportManager.php and 1 other location - About 45 mins to fix
        api/src/Match/Service/MassImportManager.php on lines 240..244

        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