Covivo/mobicoop

View on GitHub
api/src/Solidary/Service/SolidaryManager.php

Summary

Maintainability
F
1 wk
Test Coverage

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

        if ($solidary->getHomeAddress()) {
            $homeAddress = new Address();
            $homeAddress->setHouseNumber(isset($solidary->getHomeAddress()['houseNumber']) ? $solidary->getHomeAddress()['houseNumber'] : null);
            $homeAddress->setStreet(isset($solidary->getHomeAddress()['street']) ? $solidary->getHomeAddress()['street'] : null);
            $homeAddress->setStreetAddress(isset($solidary->getHomeAddress()['streetAddress']) ? $solidary->getHomeAddress()['streetAddress'] : null);
Severity: Major
Found in api/src/Solidary/Service/SolidaryManager.php and 1 other location - About 2 days to fix
api/src/Solidary/Service/SolidaryManager.php on lines 760..777

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

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 ($solidary->getDestination()) {
            $destination = new Address();
            $destination->setHouseNumber(isset($solidary->getDestination()['houseNumber']) ? $solidary->getDestination()['houseNumber'] : null);
            $destination->setStreet(isset($solidary->getDestination()['street']) ? $solidary->getDestination()['street'] : null);
            $destination->setStreetAddress(isset($solidary->getDestination()['streetAddress']) ? $solidary->getDestination()['streetAddress'] : null);
Severity: Major
Found in api/src/Solidary/Service/SolidaryManager.php and 1 other location - About 2 days to fix
api/src/Solidary/Service/SolidaryManager.php on lines 952..977

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

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

        foreach ($solidary->getProofs() as $givenProof) {
            // We get the structure proof and we create a proof to persist
            $structureProofId = null;
            if (strrpos($givenProof['id'], '/')) {
                $structureProofId = substr($givenProof['id'], strrpos($givenProof['id'], '/') + 1);
Severity: Major
Found in api/src/Solidary/Service/SolidaryManager.php and 2 other locations - About 4 hrs to fix
api/src/Solidary/Service/SolidaryUserManager.php on lines 627..641
api/src/Solidary/Service/SolidaryUserManager.php on lines 824..838

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

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 __construct(EntityManagerInterface $entityManager, EventDispatcherInterface $eventDispatcher, Security $security, SolidaryRepository $solidaryRepository, SolidaryUserRepository $solidaryUserRepository, AdManager $adManager, SolidaryMatcher $solidaryMatcher, SolidaryAskRepository $solidaryAskRepository, AddressRepository $addressRepository, ProposalRepository $proposalRepository, SolidaryUserStructureRepository $solidaryUserStructureRepository, UserManager $userManager, UserRepository $userRepository, StructureProofRepository $structureProofRepository, StructureRepository $structureRepository, AuthItemRepository $authItemRepository, SolidaryTransportMatcher $solidaryTransportMatcher)
    {
        $this->entityManager = $entityManager;
        $this->eventDispatcher = $eventDispatcher;
        $this->security = $security;
Severity: Major
Found in api/src/Solidary/Service/SolidaryManager.php and 1 other location - About 3 hrs to fix
api/src/User/Admin/Service/UserManager.php on lines 86..122

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

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

            } else {
                $solidaries = $solidaryUserStructure->getSolidaries();
                if (!empty($solidaries)) {
                    foreach ($solidaries as $solidary) {
                        // we check if we indicate a progression if yes we get only solidaries with that progression
Severity: Major
Found in api/src/Solidary/Service/SolidaryManager.php and 1 other location - About 1 hr to fix
api/src/Solidary/Service/SolidaryManager.php on lines 362..377

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

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 ($solidaryUserStructure->getSolidaryUser()->getId() == $solidaryUserId) {
                    $solidaries = $solidaryUserStructure->getSolidaries();
                    if (!empty($solidaries)) {
                        foreach ($solidaries as $solidary) {
                            // we check if we indicate a progression if yes we get only solidaries with that progression
Severity: Major
Found in api/src/Solidary/Service/SolidaryManager.php and 1 other location - About 1 hr to fix
api/src/Solidary/Service/SolidaryManager.php on lines 379..394

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

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 ($solidary->getProposal()->getProposalLinked()->getCriteria()->isWedCheck()) {
                    $returnHours = $solidary->getProposal()->getProposalLinked()->getCriteria()->getWedTime()->format('H');
                    $returnMinutes = $solidary->getProposal()->getProposalLinked()->getCriteria()->getWedTime()->format('i');
                    $returnTimes['wed'] = $solidary->getProposal()->getProposalLinked()->getCriteria()->getWedTime()->format('H:i');
                }
Severity: Major
Found in api/src/Solidary/Service/SolidaryManager.php and 6 other locations - About 45 mins to fix
api/src/Solidary/Service/SolidaryManager.php on lines 197..201
api/src/Solidary/Service/SolidaryManager.php on lines 202..206
api/src/Solidary/Service/SolidaryManager.php on lines 212..216
api/src/Solidary/Service/SolidaryManager.php on lines 217..221
api/src/Solidary/Service/SolidaryManager.php on lines 222..226
api/src/Solidary/Service/SolidaryManager.php on lines 227..231

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

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 ($solidary->getProposal()->getProposalLinked()->getCriteria()->isTueCheck()) {
                    $returnHours = $solidary->getProposal()->getProposalLinked()->getCriteria()->getTueTime()->format('H');
                    $returnMinutes = $solidary->getProposal()->getProposalLinked()->getCriteria()->getTueTime()->format('i');
                    $returnTimes['tue'] = $solidary->getProposal()->getProposalLinked()->getCriteria()->getTueTime()->format('H:i');
                }
Severity: Major
Found in api/src/Solidary/Service/SolidaryManager.php and 6 other locations - About 45 mins to fix
api/src/Solidary/Service/SolidaryManager.php on lines 197..201
api/src/Solidary/Service/SolidaryManager.php on lines 207..211
api/src/Solidary/Service/SolidaryManager.php on lines 212..216
api/src/Solidary/Service/SolidaryManager.php on lines 217..221
api/src/Solidary/Service/SolidaryManager.php on lines 222..226
api/src/Solidary/Service/SolidaryManager.php on lines 227..231

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

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 ($solidary->getProposal()->getProposalLinked()->getCriteria()->isSatCheck()) {
                    $returnHours = $solidary->getProposal()->getProposalLinked()->getCriteria()->getSatTime()->format('H');
                    $returnMinutes = $solidary->getProposal()->getProposalLinked()->getCriteria()->getSatTime()->format('i');
                    $returnTimes['sat'] = $solidary->getProposal()->getProposalLinked()->getCriteria()->getSatTime()->format('H:i');
                }
Severity: Major
Found in api/src/Solidary/Service/SolidaryManager.php and 6 other locations - About 45 mins to fix
api/src/Solidary/Service/SolidaryManager.php on lines 197..201
api/src/Solidary/Service/SolidaryManager.php on lines 202..206
api/src/Solidary/Service/SolidaryManager.php on lines 207..211
api/src/Solidary/Service/SolidaryManager.php on lines 212..216
api/src/Solidary/Service/SolidaryManager.php on lines 217..221
api/src/Solidary/Service/SolidaryManager.php on lines 227..231

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

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 ($solidary->getProposal()->getProposalLinked()->getCriteria()->isThuCheck()) {
                    $returnHours = $solidary->getProposal()->getProposalLinked()->getCriteria()->getThuTime()->format('H');
                    $returnMinutes = $solidary->getProposal()->getProposalLinked()->getCriteria()->getThuTime()->format('i');
                    $returnTimes['thu'] = $solidary->getProposal()->getProposalLinked()->getCriteria()->getThuTime()->format('H:i');
                }
Severity: Major
Found in api/src/Solidary/Service/SolidaryManager.php and 6 other locations - About 45 mins to fix
api/src/Solidary/Service/SolidaryManager.php on lines 197..201
api/src/Solidary/Service/SolidaryManager.php on lines 202..206
api/src/Solidary/Service/SolidaryManager.php on lines 207..211
api/src/Solidary/Service/SolidaryManager.php on lines 217..221
api/src/Solidary/Service/SolidaryManager.php on lines 222..226
api/src/Solidary/Service/SolidaryManager.php on lines 227..231

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

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 ($solidary->getProposal()->getProposalLinked()->getCriteria()->isSunCheck()) {
                    $returnHours = $solidary->getProposal()->getProposalLinked()->getCriteria()->getSunTime()->format('H');
                    $returnMinutes = $solidary->getProposal()->getProposalLinked()->getCriteria()->getSunTime()->format('i');
                    $returnTimes['sun'] = $solidary->getProposal()->getProposalLinked()->getCriteria()->getSunTime()->format('H:i');
                }
Severity: Major
Found in api/src/Solidary/Service/SolidaryManager.php and 6 other locations - About 45 mins to fix
api/src/Solidary/Service/SolidaryManager.php on lines 197..201
api/src/Solidary/Service/SolidaryManager.php on lines 202..206
api/src/Solidary/Service/SolidaryManager.php on lines 207..211
api/src/Solidary/Service/SolidaryManager.php on lines 212..216
api/src/Solidary/Service/SolidaryManager.php on lines 217..221
api/src/Solidary/Service/SolidaryManager.php on lines 222..226

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

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 ($solidary->getProposal()->getProposalLinked()->getCriteria()->isMonCheck()) {
                    $returnHours = $solidary->getProposal()->getProposalLinked()->getCriteria()->getMonTime()->format('H');
                    $returnMinutes = $solidary->getProposal()->getProposalLinked()->getCriteria()->getMonTime()->format('i');
                    $returnTimes['mon'] = $solidary->getProposal()->getProposalLinked()->getCriteria()->getMonTime()->format('H:i');
                }
Severity: Major
Found in api/src/Solidary/Service/SolidaryManager.php and 6 other locations - About 45 mins to fix
api/src/Solidary/Service/SolidaryManager.php on lines 202..206
api/src/Solidary/Service/SolidaryManager.php on lines 207..211
api/src/Solidary/Service/SolidaryManager.php on lines 212..216
api/src/Solidary/Service/SolidaryManager.php on lines 217..221
api/src/Solidary/Service/SolidaryManager.php on lines 222..226
api/src/Solidary/Service/SolidaryManager.php on lines 227..231

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

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 ($solidary->getProposal()->getProposalLinked()->getCriteria()->isFriCheck()) {
                    $returnHours = $solidary->getProposal()->getProposalLinked()->getCriteria()->getFriTime()->format('H');
                    $returnMinutes = $solidary->getProposal()->getProposalLinked()->getCriteria()->getFriTime()->format('i');
                    $returnTimes['fri'] = $solidary->getProposal()->getProposalLinked()->getCriteria()->getFriTime()->format('H:i');
                }
Severity: Major
Found in api/src/Solidary/Service/SolidaryManager.php and 6 other locations - About 45 mins to fix
api/src/Solidary/Service/SolidaryManager.php on lines 197..201
api/src/Solidary/Service/SolidaryManager.php on lines 202..206
api/src/Solidary/Service/SolidaryManager.php on lines 207..211
api/src/Solidary/Service/SolidaryManager.php on lines 212..216
api/src/Solidary/Service/SolidaryManager.php on lines 222..226
api/src/Solidary/Service/SolidaryManager.php on lines 227..231

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

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