Covivo/mobicoop

View on GitHub
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php

Summary

Maintainability
D
1 day
Test Coverage

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

    private function middleHour($heureMin, $heureMax, $dateMin, $dateMax)
    {
        $min = \DateTime::createFromFormat('Y-m-d H:i:s', $dateMin.' '.$heureMin, new \DateTimeZone('UTC'));
        $mintime = $min->getTimestamp();
        $max = \DateTime::createFromFormat('Y-m-d H:i:s', $dateMax.' '.$heureMax, new \DateTimeZone('UTC'));
api/src/ExternalJourney/Service/ExternalJourneyManager.php on lines 301..313

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

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

                    'sat' => 1 == $currentJourney['days']['saturday'] && !is_null($currentJourney['outward']['saturday']['mintime']) ? $this->middleHour($currentJourney['outward']['saturday']['mintime'], $currentJourney['outward']['saturday']['maxtime'], $currentJourney['outward']['mindate'], $currentJourney['outward']['mindate']) : false,
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 285..285
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 286..286
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 287..287
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 288..288
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 289..289
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 291..291

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

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

                    'thu' => 1 == $currentJourney['days']['thursday'] && !is_null($currentJourney['outward']['thursday']['mintime']) ? $this->middleHour($currentJourney['outward']['thursday']['mintime'], $currentJourney['outward']['thursday']['maxtime'], $currentJourney['outward']['mindate'], $currentJourney['outward']['mindate']) : false,
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 285..285
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 286..286
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 287..287
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 289..289
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 290..290
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 291..291

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

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

                    'sun' => 1 == $currentJourney['days']['sunday'] && !is_null($currentJourney['outward']['sunday']['mintime']) ? $this->middleHour($currentJourney['outward']['sunday']['mintime'], $currentJourney['outward']['sunday']['maxtime'], $currentJourney['outward']['mindate'], $currentJourney['outward']['mindate']) : false,
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 285..285
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 286..286
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 287..287
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 288..288
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 289..289
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 290..290

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

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

                    'mon' => 1 == $currentJourney['days']['monday'] && !is_null($currentJourney['outward']['monday']['mintime']) ? $this->middleHour($currentJourney['outward']['monday']['mintime'], $currentJourney['outward']['monday']['maxtime'], $currentJourney['outward']['mindate'], $currentJourney['outward']['mindate']) : false,
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 286..286
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 287..287
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 288..288
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 289..289
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 290..290
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 291..291

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

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

                    'fri' => 1 == $currentJourney['days']['friday'] && !is_null($currentJourney['outward']['friday']['mintime']) ? $this->middleHour($currentJourney['outward']['friday']['mintime'], $currentJourney['outward']['friday']['maxtime'], $currentJourney['outward']['mindate'], $currentJourney['outward']['mindate']) : false,
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 285..285
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 286..286
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 287..287
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 288..288
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 290..290
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 291..291

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

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

                    'tue' => 1 == $currentJourney['days']['tuesday'] && !is_null($currentJourney['outward']['tuesday']['mintime']) ? $this->middleHour($currentJourney['outward']['tuesday']['mintime'], $currentJourney['outward']['tuesday']['maxtime'], $currentJourney['outward']['mindate'], $currentJourney['outward']['mindate']) : false,
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 285..285
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 287..287
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 288..288
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 289..289
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 290..290
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 291..291

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

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

                    'wed' => 1 == $currentJourney['days']['wednesday'] && !is_null($currentJourney['outward']['wednesday']['mintime']) ? $this->middleHour($currentJourney['outward']['wednesday']['mintime'], $currentJourney['outward']['wednesday']['maxtime'], $currentJourney['outward']['mindate'], $currentJourney['outward']['mindate']) : false,
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 285..285
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 286..286
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 288..288
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 289..289
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 290..290
api/src/ExternalJourney/Admin/Service/ExternalJourneyManager.php on lines 291..291

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

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 ($currentJourney['days'][$day] && !is_null($currentJourney['outward'][$day]['mintime'])) {
                    $time = $this->middleHour($currentJourney['outward'][$day]['mintime'], $currentJourney['outward'][$day]['maxtime'], $currentJourney['outward']['mindate'], $currentJourney['outward']['mindate']);

                    // Only the first time to init the reference
                    if ('' === $currentTime) {
api/src/ExternalJourney/Service/ExternalJourneyManager.php on lines 187..200

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

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

        foreach ($days as $day) {
            $mintime = $request->get($day.'_mintime');
            if ('' !== $mintime) {
                $searchParameters['outward'][$day]['mintime'] = $mintime;
            }
api/src/ExternalJourney/Service/JourneyProviderRdex.php on lines 105..114
api/src/ExternalJourney/Service/JourneyProviderStandardRdex.php on lines 92..101

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