laravel/framework

View on GitHub
src/Illuminate/Validation/Concerns/ReplacesAttributes.php

Summary

Maintainability
D
2 days
Test Coverage

File ReplacesAttributes.php has 296 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Illuminate\Validation\Concerns;

use Illuminate\Support\Arr;
Severity: Minor
Found in src/Illuminate/Validation/Concerns/ReplacesAttributes.php - About 3 hrs to fix

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

        protected function replaceRequiredUnless($message, $attribute, $rule, $parameters)
        {
            $other = $this->getDisplayableAttribute($parameters[0]);
    
            $values = [];
    Severity: Major
    Found in src/Illuminate/Validation/Concerns/ReplacesAttributes.php and 1 other location - About 2 hrs to fix
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 661..672

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

    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

        protected function replaceProhibitedUnless($message, $attribute, $rule, $parameters)
        {
            $other = $this->getDisplayableAttribute($parameters[0]);
    
            $values = [];
    Severity: Major
    Found in src/Illuminate/Validation/Concerns/ReplacesAttributes.php and 1 other location - About 2 hrs to fix
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 621..632

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

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

        protected function replaceAcceptedIf($message, $attribute, $rule, $parameters)
        {
            $parameters[1] = $this->getDisplayableValue($parameters[0], Arr::get($this->data, $parameters[0]));
    
            $parameters[0] = $this->getDisplayableAttribute($parameters[0]);
    Severity: Major
    Found in src/Illuminate/Validation/Concerns/ReplacesAttributes.php and 5 other locations - About 1 hr to fix
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 36..43
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 214..221
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 383..389
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 587..594
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 643..650

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

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

        protected function replaceRequiredIf($message, $attribute, $rule, $parameters)
        {
            $parameters[1] = $this->getDisplayableValue($parameters[0], Arr::get($this->data, $parameters[0]));
    
            $parameters[0] = $this->getDisplayableAttribute($parameters[0]);
    Severity: Major
    Found in src/Illuminate/Validation/Concerns/ReplacesAttributes.php and 5 other locations - About 1 hr to fix
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 18..25
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 36..43
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 214..221
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 383..389
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 643..650

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

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

        protected function replaceMissingIf($message, $attribute, $rule, $parameters)
        {
            $parameters[1] = $this->getDisplayableValue($parameters[0], Arr::get($this->data, $parameters[0]));
    
            $parameters[0] = $this->getDisplayableAttribute($parameters[0]);
    Severity: Major
    Found in src/Illuminate/Validation/Concerns/ReplacesAttributes.php and 5 other locations - About 1 hr to fix
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 18..25
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 36..43
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 383..389
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 587..594
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 643..650

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

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

        protected function replaceProhibitedIf($message, $attribute, $rule, $parameters)
        {
            $parameters[1] = $this->getDisplayableValue($parameters[0], Arr::get($this->data, $parameters[0]));
    
            $parameters[0] = $this->getDisplayableAttribute($parameters[0]);
    Severity: Major
    Found in src/Illuminate/Validation/Concerns/ReplacesAttributes.php and 5 other locations - About 1 hr to fix
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 18..25
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 36..43
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 214..221
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 383..389
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 587..594

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

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

        protected function replacePresentIf($message, $attribute, $rule, $parameters)
        {
            $parameters[1] = $this->getDisplayableValue($parameters[0], Arr::get($this->data, $parameters[0]));
            $parameters[0] = $this->getDisplayableAttribute($parameters[0]);
    
    
    Severity: Major
    Found in src/Illuminate/Validation/Concerns/ReplacesAttributes.php and 5 other locations - About 1 hr to fix
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 18..25
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 36..43
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 214..221
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 587..594
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 643..650

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

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

        protected function replaceDeclinedIf($message, $attribute, $rule, $parameters)
        {
            $parameters[1] = $this->getDisplayableValue($parameters[0], Arr::get($this->data, $parameters[0]));
    
            $parameters[0] = $this->getDisplayableAttribute($parameters[0]);
    Severity: Major
    Found in src/Illuminate/Validation/Concerns/ReplacesAttributes.php and 5 other locations - About 1 hr to fix
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 18..25
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 214..221
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 383..389
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 587..594
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 643..650

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

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

        protected function replaceGte($message, $attribute, $rule, $parameters)
        {
            if (is_null($value = $this->getValue($parameters[0]))) {
                return str_replace(':value', $this->getDisplayableAttribute($parameters[0]), $message);
            }
    Severity: Major
    Found in src/Illuminate/Validation/Concerns/ReplacesAttributes.php and 3 other locations - About 50 mins to fix
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 515..522
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 533..540
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 569..576

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

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

        protected function replaceGt($message, $attribute, $rule, $parameters)
        {
            if (is_null($value = $this->getValue($parameters[0]))) {
                return str_replace(':value', $this->getDisplayableAttribute($parameters[0]), $message);
            }
    Severity: Major
    Found in src/Illuminate/Validation/Concerns/ReplacesAttributes.php and 3 other locations - About 50 mins to fix
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 533..540
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 551..558
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 569..576

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

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

        protected function replaceLte($message, $attribute, $rule, $parameters)
        {
            if (is_null($value = $this->getValue($parameters[0]))) {
                return str_replace(':value', $this->getDisplayableAttribute($parameters[0]), $message);
            }
    Severity: Major
    Found in src/Illuminate/Validation/Concerns/ReplacesAttributes.php and 3 other locations - About 50 mins to fix
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 515..522
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 533..540
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 551..558

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

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

        protected function replaceLt($message, $attribute, $rule, $parameters)
        {
            if (is_null($value = $this->getValue($parameters[0]))) {
                return str_replace(':value', $this->getDisplayableAttribute($parameters[0]), $message);
            }
    Severity: Major
    Found in src/Illuminate/Validation/Concerns/ReplacesAttributes.php and 3 other locations - About 50 mins to fix
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 515..522
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 551..558
    src/Illuminate/Validation/Concerns/ReplacesAttributes.php on lines 569..576

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

    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