t1gor/Robots.txt-Parser-Class

View on GitHub
source/Parser/DirectiveProcessors/CacheDelayProcessor.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid unused parameters such as '$prevLine'.
Open

    public function process(string $line, array & $root, string & $currentUserAgent = '*', string $prevLine = '') {

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

Opening brace of a class must be on the line after the definition
Open

class CacheDelayProcessor extends AbstractDirectiveProcessor implements DirectiveProcessorInterface {

Spaces must be used to indent lines; tabs are not allowed
Open

        $parts              = explode(':', $line);

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

                '{faulty}'    => $parts[1],

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

    public function process(string $line, array & $root, string & $currentUserAgent = '*', string $prevLine = '') {

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->log('{directive} with value {faulty} dropped as invalid', [

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

        return Directive::CACHE_DELAY;

Spaces must be used to indent lines; tabs are not allowed
Open

            return;

Spaces must be used to indent lines; tabs are not allowed
Open

                '{directive}' => Directive::CACHE_DELAY,

Spaces must be used to indent lines; tabs are not allowed
Open

        $root[$currentUserAgent][Directive::CACHE_DELAY] = $filteredCacheDelay;

Spaces must be used to indent lines; tabs are not allowed
Open

        if (false === $filteredCacheDelay) {

Spaces must be used to indent lines; tabs are not allowed
Open

        $filteredCacheDelay = filter_var($parts[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);

Spaces must be used to indent lines; tabs are not allowed
Open

            ]);

Spaces must be used to indent lines; tabs are not allowed
Open

    public function getDirectiveName(): string {

Opening brace should be on a new line
Open

    public function getDirectiveName(): string {

Opening brace should be on a new line
Open

    public function process(string $line, array & $root, string & $currentUserAgent = '*', string $prevLine = '') {

There are no issues that match your filters.

Category
Status