codeformunich/Muenchen-Transparent

View on GitHub
protected/RISParser/StadtraetInnenData.php

Summary

Maintainability
A
1 hr
Test Coverage

Method parseFromHtml has 34 lines of code (exceeds 30 allowed). Consider refactoring.
Open

    public static function parseFromHtml(string $htmlFraktion, string $htmlAusschuss): ?self
    {
        if (!preg_match('/<h1 class="page-title">\n<span[^>]*>(?<name>[^<]*) <span/siuU', $htmlFraktion, $match)) {
            throw new ParsingException('Not found: name');
        }
Severity: Minor
Found in protected/RISParser/StadtraetInnenData.php - About 1 hr to fix

    The method parseFromHtml() has an NPath complexity of 256. The configured NPath complexity threshold is 200.
    Open

        public static function parseFromHtml(string $htmlFraktion, string $htmlAusschuss): ?self
        {
            if (!preg_match('/<h1 class="page-title">\n<span[^>]*>(?<name>[^<]*) <span/siuU', $htmlFraktion, $match)) {
                throw new ParsingException('Not found: name');
            }

    NPathComplexity

    Since: 0.1

    The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

    Example

    class Foo {
        function bar() {
            // lots of complicated code
        }
    }

    Source https://phpmd.org/rules/codesize.html#npathcomplexity

    TODO found
    Open

            // @TODO This is only the first page with the most recent memberships

    Avoid excessively long variable names like $fraktionsMitgliedschaften. Keep variable name length under 20.
    Open

        public array $fraktionsMitgliedschaften;

    LongVariable

    Since: 0.2

    Detects when a field, formal or local variable is declared with a long name.

    Example

    class Something {
        protected $reallyLongIntName = -3; // VIOLATION - Field
        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
            $otherReallyLongName = -5; // VIOLATION - Local
            for ($interestingIntIndex = 0; // VIOLATION - For
                 $interestingIntIndex < 10;
                 $interestingIntIndex++ ) {
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#longvariable

    Avoid excessively long variable names like $ausschussMitgliedschaften. Keep variable name length under 20.
    Open

        public array $ausschussMitgliedschaften;

    LongVariable

    Since: 0.2

    Detects when a field, formal or local variable is declared with a long name.

    Example

    class Something {
        protected $reallyLongIntName = -3; // VIOLATION - Field
        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
            $otherReallyLongName = -5; // VIOLATION - Local
            for ($interestingIntIndex = 0; // VIOLATION - For
                 $interestingIntIndex < 10;
                 $interestingIntIndex++ ) {
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#longvariable

    There are no issues that match your filters.

    Category
    Status