JamesRezo/webhelper-parser

View on GitHub

Showing 23 of 23 total issues

Server has 28 functions (exceeds 20 allowed). Consider refactoring.
Open

class Server implements ServerInterface
{
    /**
     * a Checker instance.
     *
Severity: Minor
Found in src/Server/Server.php - About 3 hrs to fix

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

        private $dumperSimpleDirective = '';
    Severity: Minor
    Found in src/Server/Server.php by phpmd

    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

    Function getExposedPath has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getExposedPath($url)
        {
            $isExposedAs = '';
            list($host, $path) = $this->getUriHostAndPath($url);
    
    
    Severity: Minor
    Found in src/Parser/Descriptor.php - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Avoid using static access to class '\WebHelper\Parser\Parser\Before' in method 'beforeExplode'.
    Open

                $config = Before::$beforeMethod($config);
    Severity: Minor
    Found in src/Parser.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class 'WebHelper\Parser\Server\ServerException' in method 'setPrefix'.
    Open

                throw ServerException::forInvalidPrefix($prefix, 'The path is expected to be a string. Got: %s');
    Severity: Minor
    Found in src/Server/Server.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class 'WebHelper\Parser\Server\ServerException' in method 'setPrefix'.
    Open

                throw ServerException::forInvalidPrefix(
                    $prefix,
                    'The path is expected to be absolute and an existing directory. Got: %s'
                );
    Severity: Minor
    Found in src/Server/Server.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class '\League\Uri\Schemes\Http' in method 'getUriHostAndPath'.
    Open

                $uri = HttpUri::createFromString($url);
    Severity: Minor
    Found in src/Parser/Descriptor.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class 'WebHelper\Parser\Server\ServerException' in method 'setRegexDirective'.
    Open

                throw ServerException::forInvalidMatcher(
                    $directive,
                    $message2
                );
    Severity: Minor
    Found in src/Server/Server.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class 'WebHelper\Parser\Server\ServerException' in method 'isValidDirective'.
    Open

                throw ServerException::forInvalidMatcher(
                    $directive,
                    $message1
                );
    Severity: Minor
    Found in src/Server/Server.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class '\WebHelper\Parser\Exception\InvalidConfigException' in method 'findEndingKey'.
    Open

            throw InvalidConfigException::forEndingKeyNotFound($context);
    Severity: Minor
    Found in src/Compiler.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class '\WebHelper\Parser\Exception\InvalidConfigException' in method 'setConfigFile'.
    Open

                throw InvalidConfigException::forEmptyConfig($configFile);
    Severity: Minor
    Found in src/Parser.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid unused parameters such as '$directive'.
    Open

        public function add(DirectiveInterface $directive)
    Severity: Minor
    Found in src/Directive/Directive.php by phpmd

    UnusedFormalParameter

    Since: 0.2

    Avoid passing parameters to methods or constructors and then not using those parameters.

    Example

    class Foo
    {
        private function bar($howdy)
        {
            // $howdy is not used
        }
    }

    Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

    Avoid using static access to class '\Webmozart\PathUtil\Path' in method 'getRelative'.
    Open

                Path::isBasePath($against, Path::getDirectory($path))
    Severity: Minor
    Found in src/Parser/Descriptor.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class 'WebHelper\Parser\Server\ServerException' in method 'isValidDirective'.
    Open

                throw ServerException::forInvalidMatcher(
                    $directive,
                    $message2
                );
    Severity: Minor
    Found in src/Server/Server.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid unused parameters such as '$name'.
    Open

        public function hasDirective($name)
    Severity: Minor
    Found in src/Directive/SimpleDirective.php by phpmd

    UnusedFormalParameter

    Since: 0.2

    Avoid passing parameters to methods or constructors and then not using those parameters.

    Example

    class Foo
    {
        private function bar($howdy)
        {
            // $howdy is not used
        }
    }

    Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

    Avoid using static access to class '\WebHelper\Parser\Exception\ParserException' in method 'setConfigFile'.
    Open

                throw ParserException::forFileUnreadable($configFile);
    Severity: Minor
    Found in src/Parser.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class '\Webmozart\PathUtil\Path' in method 'isValidAbsolutePath'.
    Open

            if (!Path::isAbsolute($this->string)) {
    Severity: Minor
    Found in src/Parser/Checker.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class '\WebHelper\Parser\Exception\InvalidConfigException' in method 'subCompile'.
    Open

                throw InvalidConfigException::forSimpleDirectiveSyntaxError($lineConfig);
    Severity: Minor
    Found in src/Compiler.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class '\Webmozart\PathUtil\Path' in method 'getRelative'.
    Open

                $relative = Path::makeRelative($path, $against);
    Severity: Minor
    Found in src/Parser/Descriptor.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class '\Webmozart\Assert\Assert' in method 'setString'.
    Open

                Assert::string($string);
    Severity: Minor
    Found in src/Parser/Checker.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Severity
    Category
    Status
    Source
    Language