AJenbo/agcms

View on GitHub
application/inc/Countries.php

Summary

Maintainability
C
1 day
Test Coverage
A
100%

Method getCountries has 226 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private static function getCountries(): array
    {
        return [
            'DK' => _('Denmark'),
            'FI' => _('Finland'),
Severity: Major
Found in application/inc/Countries.php - About 1 day to fix

    The method getCountries() has 247 lines of code. Current threshold is set to 100. Avoid really long methods.
    Open

        private static function getCountries(): array
        {
            return [
                'DK' => _('Denmark'),
                'FI' => _('Finland'),
    Severity: Minor
    Found in application/inc/Countries.php by phpmd

    This function "getCountries" has 246 lines, which is greater than the 150 lines authorized. Split it into smaller functions.
    Open

        private static function getCountries(): array
    Severity: Major
    Found in application/inc/Countries.php by sonar-php

    A function that grows too large tends to aggregate too many responsibilities.

    Such functions inevitably become harder to understand and therefore harder to maintain.

    Above a specific threshold, it is strongly advised to refactor into smaller functions which focus on well-defined tasks.

    Those smaller functions will not only be easier to understand, but also probably easier to test.

    Line indented incorrectly; expected at least 4 spaces, found 0
    Open

    {

    Line indented incorrectly; expected at least 8 spaces, found 4
    Open

        $countries = self::getCountries();

    Line indented incorrectly; expected at least 8 spaces, found 4
    Open

        return $countries;

    Line indented incorrectly; expected at least 8 spaces, found 4
    Open

        natcasesort($countries);

    Line indented incorrectly; expected 4 spaces, found 0
    Open

    }

    Line indented incorrectly; expected 4 spaces, found 0
    Open

    public static function getOrdered(): array

    There are no issues that match your filters.

    Category
    Status