t1gor/Robots.txt-Parser-Class

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

Summary

Maintainability
A
0 mins
Test Coverage

Showing 21 of 21 total issues

Avoid unused parameters such as '$prevLine'.
Open

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

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

class CrawlDelayProcessor extends AbstractDirectiveProcessor implements DirectiveProcessorInterface {

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

if (false === $filteredCrawlDelay) {

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

'{faulty}' => $entry,

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

$entry = trim($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

return;

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

return Directive::CRAWL_DELAY;

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(strtr('{directive} with value {faulty} dropped as invalid for {useragent}', [

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

public function getDirectiveName(): string {

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

$filteredCrawlDelay = filter_var($entry, FILTER_VALIDATE_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

'{useragent}' => $currentUserAgent

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

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

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

}

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

$root[$currentUserAgent][Directive::CRAWL_DELAY] = $filteredCrawlDelay;

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