Covivo/mobicoop

View on GitHub
api/src/Carpool/Repository/ProposalRepository.php

Summary

Maintainability
F
1 wk
Test Coverage

ProposalRepository has 27 functions (exceeds 20 allowed). Consider refactoring.
Open

class ProposalRepository
{
    private $bearing_range;                   // if used, only accept proposal where the bearing direction (cape) is not at the opposite, more or less the range degrees
    // for example, if the bearing is 0 (s->n), the proposals where the bearing is between 170 and 190 (~ n->s) are excluded
    private $passenger_proportion;           // minimum passenger distance relative to the driver distance, eg passenger distance should be at least 30% of the driver distance
Severity: Minor
Found in api/src/Carpool/Repository/ProposalRepository.php - About 3 hrs to fix

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

                if ($this->use_bbox) {
                    if ('' != $zonePassengerWhere) {
                        $zonePassengerWhere .= ' and ';
                    }
                    $zonePassengerWhere .= '(ST_INTERSECTS(dp.geoJsonBbox,ST_GeomFromText(\''.
    Severity: Major
    Found in api/src/Carpool/Repository/ProposalRepository.php and 1 other location - About 6 hrs to fix
    api/src/Carpool/Repository/ProposalRepository.php on lines 359..384

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

    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 ($this->use_bbox) {
                    if ('' != $zoneDriverWhere) {
                        $zoneDriverWhere .= ' and ';
                    }
                    $zoneDriverWhere .= '(ST_INTERSECTS(dd.geoJsonBbox,ST_GeomFromText(\''.
    Severity: Major
    Found in api/src/Carpool/Repository/ProposalRepository.php and 1 other location - About 6 hrs to fix
    api/src/Carpool/Repository/ProposalRepository.php on lines 280..305

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

    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

        public function findRegularAdWithoutAskSinceXDays(?int $nbOfDays = null): ?array
        {
            $now = (new \DateTime('now'));
            $createdDate = $now->modify('-'.$nbOfDays.' days')->format('Y-m-d');
    
    
    Severity: Major
    Found in api/src/Carpool/Repository/ProposalRepository.php and 1 other location - About 6 hrs to fix
    api/src/Carpool/Repository/ProposalRepository.php on lines 1412..1460

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

    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

        public function findPunctualAdWithoutAskSinceXDays(?int $nbOfDays = null): ?array
        {
            $now = (new \DateTime('now'));
            $createdDate = $now->modify('-'.$nbOfDays.' days')->format('Y-m-d');
    
    
    Severity: Major
    Found in api/src/Carpool/Repository/ProposalRepository.php and 1 other location - About 6 hrs to fix
    api/src/Carpool/Repository/ProposalRepository.php on lines 1462..1510

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

    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 ($proposalsDriver as $proposalDriver) {
                // we have to check for an existing outward for a return proposal => we keep only outward
                if (Proposal::TYPE_RETURN == $proposalDriver->getType()) {
                    $foundOutward = false;
                    foreach ($proposalsDriver as $proposal) {
    Severity: Major
    Found in api/src/Carpool/Repository/ProposalRepository.php and 1 other location - About 5 hrs to fix
    api/src/Carpool/Repository/ProposalRepository.php on lines 1094..1133

    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

            foreach ($proposalsPassenger as $proposalPassenger) {
                // we have to check for an existing outward for a return proposal => we keep only outward
                if (Proposal::TYPE_RETURN == $proposalPassenger->getType()) {
                    $foundOutward = false;
                    foreach ($proposalsPassenger as $proposal) {
    Severity: Major
    Found in api/src/Carpool/Repository/ProposalRepository.php and 1 other location - About 5 hrs to fix
    api/src/Carpool/Repository/ProposalRepository.php on lines 1053..1092

    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

                    if ($proposal->getCriteria()->isFriCheck()) {
                        $regularFriDay = 'c.friCheck = 1';
                        $days .= '6,'; // used for punctual candidate
                        if ($proposal->getCriteria()->getFriTime()) {
                            if (!$driversOnly && $proposal->getCriteria()->isDriver() && $proposal->getCriteria()->isPassenger()) {
    Severity: Major
    Found in api/src/Carpool/Repository/ProposalRepository.php and 6 other locations - About 4 hrs to fix
    api/src/Carpool/Repository/ProposalRepository.php on lines 598..622
    api/src/Carpool/Repository/ProposalRepository.php on lines 623..647
    api/src/Carpool/Repository/ProposalRepository.php on lines 648..672
    api/src/Carpool/Repository/ProposalRepository.php on lines 673..697
    api/src/Carpool/Repository/ProposalRepository.php on lines 698..722
    api/src/Carpool/Repository/ProposalRepository.php on lines 748..772

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

    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

                    if ($proposal->getCriteria()->isThuCheck()) {
                        $regularThuDay = 'c.thuCheck = 1';
                        $days .= '5,'; // used for punctual candidate
                        if ($proposal->getCriteria()->getThuTime()) {
                            if (!$driversOnly && $proposal->getCriteria()->isDriver() && $proposal->getCriteria()->isPassenger()) {
    Severity: Major
    Found in api/src/Carpool/Repository/ProposalRepository.php and 6 other locations - About 4 hrs to fix
    api/src/Carpool/Repository/ProposalRepository.php on lines 598..622
    api/src/Carpool/Repository/ProposalRepository.php on lines 623..647
    api/src/Carpool/Repository/ProposalRepository.php on lines 648..672
    api/src/Carpool/Repository/ProposalRepository.php on lines 673..697
    api/src/Carpool/Repository/ProposalRepository.php on lines 723..747
    api/src/Carpool/Repository/ProposalRepository.php on lines 748..772

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

    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

                    if ($proposal->getCriteria()->isTueCheck()) {
                        $regularTueDay = 'c.tueCheck = 1';
                        $days .= '3,'; // used for punctual candidate
                        if ($proposal->getCriteria()->getTueTime()) {
                            if (!$driversOnly && $proposal->getCriteria()->isDriver() && $proposal->getCriteria()->isPassenger()) {
    Severity: Major
    Found in api/src/Carpool/Repository/ProposalRepository.php and 6 other locations - About 4 hrs to fix
    api/src/Carpool/Repository/ProposalRepository.php on lines 598..622
    api/src/Carpool/Repository/ProposalRepository.php on lines 623..647
    api/src/Carpool/Repository/ProposalRepository.php on lines 673..697
    api/src/Carpool/Repository/ProposalRepository.php on lines 698..722
    api/src/Carpool/Repository/ProposalRepository.php on lines 723..747
    api/src/Carpool/Repository/ProposalRepository.php on lines 748..772

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

    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

                    if ($proposal->getCriteria()->isSunCheck()) {
                        $regularSunDay = 'c.sunCheck = 1';
                        $days .= '1,'; // used for punctual candidate
                        if ($proposal->getCriteria()->getSunTime()) {
                            if (!$driversOnly && $proposal->getCriteria()->isDriver() && $proposal->getCriteria()->isPassenger()) {
    Severity: Major
    Found in api/src/Carpool/Repository/ProposalRepository.php and 6 other locations - About 4 hrs to fix
    api/src/Carpool/Repository/ProposalRepository.php on lines 623..647
    api/src/Carpool/Repository/ProposalRepository.php on lines 648..672
    api/src/Carpool/Repository/ProposalRepository.php on lines 673..697
    api/src/Carpool/Repository/ProposalRepository.php on lines 698..722
    api/src/Carpool/Repository/ProposalRepository.php on lines 723..747
    api/src/Carpool/Repository/ProposalRepository.php on lines 748..772

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

    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

                    if ($proposal->getCriteria()->isMonCheck()) {
                        $regularMonDay = 'c.monCheck = 1';
                        $days .= '2,'; // used for punctual candidate
                        if ($proposal->getCriteria()->getMonTime()) {
                            if (!$driversOnly && $proposal->getCriteria()->isDriver() && $proposal->getCriteria()->isPassenger()) {
    Severity: Major
    Found in api/src/Carpool/Repository/ProposalRepository.php and 6 other locations - About 4 hrs to fix
    api/src/Carpool/Repository/ProposalRepository.php on lines 598..622
    api/src/Carpool/Repository/ProposalRepository.php on lines 648..672
    api/src/Carpool/Repository/ProposalRepository.php on lines 673..697
    api/src/Carpool/Repository/ProposalRepository.php on lines 698..722
    api/src/Carpool/Repository/ProposalRepository.php on lines 723..747
    api/src/Carpool/Repository/ProposalRepository.php on lines 748..772

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

    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

                    if ($proposal->getCriteria()->isWedCheck()) {
                        $regularWedDay = 'c.wedCheck = 1';
                        $days .= '4,'; // used for punctual candidate
                        if ($proposal->getCriteria()->getWedTime()) {
                            if (!$driversOnly && $proposal->getCriteria()->isDriver() && $proposal->getCriteria()->isPassenger()) {
    Severity: Major
    Found in api/src/Carpool/Repository/ProposalRepository.php and 6 other locations - About 4 hrs to fix
    api/src/Carpool/Repository/ProposalRepository.php on lines 598..622
    api/src/Carpool/Repository/ProposalRepository.php on lines 623..647
    api/src/Carpool/Repository/ProposalRepository.php on lines 648..672
    api/src/Carpool/Repository/ProposalRepository.php on lines 698..722
    api/src/Carpool/Repository/ProposalRepository.php on lines 723..747
    api/src/Carpool/Repository/ProposalRepository.php on lines 748..772

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

    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

                    if ($proposal->getCriteria()->isSatCheck()) {
                        $regularSatDay = 'c.satCheck = 1';
                        $days .= '7,'; // used for punctual candidate
                        if ($proposal->getCriteria()->getSatTime()) {
                            if (!$driversOnly && $proposal->getCriteria()->isDriver() && $proposal->getCriteria()->isPassenger()) {
    Severity: Major
    Found in api/src/Carpool/Repository/ProposalRepository.php and 6 other locations - About 4 hrs to fix
    api/src/Carpool/Repository/ProposalRepository.php on lines 598..622
    api/src/Carpool/Repository/ProposalRepository.php on lines 623..647
    api/src/Carpool/Repository/ProposalRepository.php on lines 648..672
    api/src/Carpool/Repository/ProposalRepository.php on lines 673..697
    api/src/Carpool/Repository/ProposalRepository.php on lines 698..722
    api/src/Carpool/Repository/ProposalRepository.php on lines 723..747

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

    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 ($this->use_bearing) {
                    if ('' != $zonePassengerWhere) {
                        $zonePassengerWhere .= ' and ';
                    }
                    $range = $this->geoTools->getOppositeBearing($proposal->getCriteria()->getDirectionDriver()->getBearing(), $this->bearing_range);
    Severity: Major
    Found in api/src/Carpool/Repository/ProposalRepository.php and 1 other location - About 3 hrs to fix
    api/src/Carpool/Repository/ProposalRepository.php on lines 340..356

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

    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 ($this->use_bearing && $proposal->getCriteria()->getDirectionPassenger()->getDistance() > 0) {
                    if ('' != $zoneDriverWhere) {
                        $zoneDriverWhere .= ' and ';
                    }
                    $range = $this->geoTools->getOppositeBearing($proposal->getCriteria()->getDirectionPassenger()->getBearing(), $this->bearing_range);
    Severity: Major
    Found in api/src/Carpool/Repository/ProposalRepository.php and 1 other location - About 3 hrs to fix
    api/src/Carpool/Repository/ProposalRepository.php on lines 261..277

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

    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

        public function findSoonExpiredAds(int $numberOfDays): ?array
        {
            $now = new \DateTime();
            $toDate = $now->modify('+'.$numberOfDays.' days')->format('Y-m-d');
    
    
    Severity: Major
    Found in api/src/Carpool/Repository/ProposalRepository.php and 1 other location - About 1 hr to fix
    api/src/Carpool/Repository/ProposalRepository.php on lines 1395..1410

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

    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

        public function findInactiveAdsSinceXDays(int $numberOfDays): ?array
        {
            $now = new \DateTime();
            $toDate = $now->modify('-'.$numberOfDays.' days')->format('Y-m-d');
    
    
    Severity: Major
    Found in api/src/Carpool/Repository/ProposalRepository.php and 1 other location - About 1 hr to fix
    api/src/Carpool/Repository/ProposalRepository.php on lines 1378..1393

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

    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